在 Emacs 中缩进模板参数
我没有运气让 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该只需将
template-args-cont
设置为一些有用的值。 要进行实验,请将光标放在第二行并输入C-cC-o
作为c-set-offset
。 插入一个方便的值。 使用 4,我得到:如果这不起作用,请检查您的版本:我有 cc-mode 版本 5.31.6。 要进行检查,请执行
Mx c-version
。 我明白了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 enterC-cC-o
forc-set-offset
. Insert a convenient value. With 4, I get: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