我有一个多重嵌套的命名空间:
namespace first {namespace second {namespace third {
// emacs indents three times
// I want to intend here
} } }
所以 emacs 缩进到第三个位置。但是我只想要一个缩进。
能不能简单的实现这个效果?
最佳答案
在命名空间内使用绝对缩进列:
(defconst my-cc-style
'("gnu"
(c-offsets-alist . ((innamespace . [4])))))
(c-add-style "my-cc-style" my-cc-style)
然后使用 c-set-style 来使用自己的风格。
请注意,这只适用于 c++-mode,c-mode 不知道 'innamespace'。
https://stackoverflow.com/questions/2619853/