在 Emacs 中缩进模板参数

发布于 2024-07-23 21:37:01 字数 556 浏览 6 评论 0原文

我没有运气让 Emacs(cc 模式)缩进多行模板参数。 这是一个示例行:

typedef ::boost::zip_iterator< ::boost::tuple<
vector<int>::const_iterator, vector<float>::const_iterator > >;

我希望第二行缩进,就像在函数中一样。 它是缩进的,直到我输入倒数第二个 >,此时第二行向左移动以与 typedef 对齐。

当我开始输入第二行时,语法分析是((statement-cont 52)),直到倒数第二个>,此时它变成((defun-block-intro 46))。 删除字符不会返回到旧的语法分析。

我希望将 template-args-cont 作为语法分析。

我使用的是 emacs 22.2 (ubuntu intrepid) 和它附带的 cc-mode 版本 5.31.5。

I'm having no luck getting Emacs (cc-mode) to indent multiline template arguments. Here's an example line:

typedef ::boost::zip_iterator< ::boost::tuple<
vector<int>::const_iterator, vector<float>::const_iterator > >;

I'd like the second line to be indented, as like in a function. It is indented, until I enter the second-to-last >, at which point the second line up moves to the left to align with the typedef.

When I start typing the second line, the syntactic analysis is ((statement-cont 52)), until the second-to-last >, at which point it becomes ((defun-block-intro 46)). Deleting the character doesn't return to the old syntactic analysis.

I expected to have template-args-cont as the syntactic analysis.

I'm using the emacs 22.2 (ubuntu intrepid) and cc-mode version 5.31.5 that came with it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深爱不及久伴 2024-07-30 21:37:01

应该只需将template-args-cont设置为一些有用的值。 要进行实验,请将光标放在第二行并输入 C-cC-o 作为 c-set-offset。 插入一个方便的值。 使用 4,我得到:

typedef ::boost::zip_iterator< ::boost::tuple<
    vector<int>::const_iterator, vector<float>::const_iterator > >; 

如果这不起作用,请检查您的版本:我有 cc-mode 版本 5.31.6。 要进行检查,请执行 Mx c-version。 我明白了

Using CC Mode version 5.31.6

You should just need to set template-args-cont to some useful value. To experiment with it, put your cursor on the second line and enter C-cC-o for c-set-offset. Insert a convenient value. With 4, I get:

typedef ::boost::zip_iterator< ::boost::tuple<
    vector<int>::const_iterator, vector<float>::const_iterator > >; 

If that doesn't work, check your version: I have cc-mode version 5.31.6. To check, do M-x c-version. I get

Using CC Mode version 5.31.6
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文