Joc*_*nde 4 c emacs coding-style indentation
默认情况下,Emacs不会缩进预处理器代码.我知道它的历史根源已经过时了.
但是,拥有大量#ifdef unindented的代码很难阅读.
所以我想让emacs自动缩进给我这样的东西:
void myfunc() {
int foo;
#ifdef BAR
printf(foo);
#endif
return foo;
}
Run Code Online (Sandbox Code Playgroud)
而不是我现在得到的:
void myfunc() {
int foo;
#ifdef BAR
printf(foo);
#endif
return foo;
}
Run Code Online (Sandbox Code Playgroud)
这个问题的任何线索你emacs黑客:)?
Rin*_*g Ø 12
您可以简单地告诉Emacs向预处理器线添加偏移量.
point
)放在预处理器行中Syntactic symbol to change:
,cpp-macro
,按Enter0
)然后TAB每个预处理器行上的a应正确缩进.(或M-xindent-region
...).
要永久更改设置,您可以在.emacs
文件中添加所需的行.
复制先前输入的命令的简单方法是c-x ESC ESC使用箭头键查找(c-set-offset ...)
Elisp命令.
那应该是
(c-set-offset (quote cpp-macro) 0 nil)
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2823 次 |
最近记录: |