可能是重复问题:
Emacs - override indentation
我想要的是 Emacs 不缩进命名空间内的代码。
namespace a_namespace{
// no indentation
int namespace_global_variable;
// no indentation
class Class {
// comment
Class();
//...
};
// and so on
}
当我尝试修改innamespace
变量或使用C-c C-o
来更改感兴趣的位置的缩进时,我没有得到期望的效果(事实上后者会杀死函数内所有缩进)。
我的缩进配置如下(从Google emacs配置复制):
(c-offsets-alist . ((arglist-intro vista-c-lineup-expression-plus-4)
(func-decl-cont . ++)
(member-init-intro . +)
(inher-intro . ++)
(comment-intro . 0)
(arglist-close . c-lineup-arglist)
(topmost-intro . 0)
(block-open . 0)
(inline-open . 0)
(substatement-open . 0)
(statement-cont
.
(,(when (fboundp 'c-no-indent-after-java-annotations)
'c-no-indent-after-java-annotations)
,(when (fboundp 'c-lineup-assignments)
'c-lineup-assignments)
++))
(label . /)
(case-label . +)
(statement-case-open . +)
(statement-case-intro . +) ; case w/o {
(access-label . /)
(innamespace . -))))
(c-set-offset 'innamespace '0)
。 - skyfire