我想按如下方式控制缩进:
#define MY_NS_MACRO namespace myns
namespace ns1 {
int a; // indent 0 as expected
int b; // indent 0 as expected
}
MY_NS_MACRO {
int c; // indent 0 manually (If I press TAB here, indent 4)
int d; // I expect indent 0, but indent 1...
}
void f() {
int e = 0; // indent 4 as expected.
}
变量a,b和e按预期缩进。变量c,emacs控制缩进4.但是,我想缩进0.所以我手动删除了四个空格。对我来说还好。然后,我输入下一个变量d,我希望该行也缩进0。但是,它是缩进的1.有没有办法控制缩进?
这是我的.emacs:
(defun my-c-c++-mode-init ()
(setq c-basic-offset 4)
(c-set-offset 'substatement-open 0)
(c-set-offset 'innamespace 0)
(c-set-offset 'arglist-intro '+)
)
(add-hook 'c-mode-hook 'my-c-c++-mode-init)
(add-hook 'c++-mode-hook 'my-c-c++-mode-init)