且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使Emacs在我的C ++代码中将访问级别修饰符放在自己的缩进级别中?

更新时间:2022-12-19 07:55:22

您需要修改 c-offsets-alist 中的$ c> access-label 缩进。
我建议您使用自己的 c-offsets-alist 制作新的样式,并添加如下一行:

You need to modify the access-label indentation in your c-offsets-alist. I recommend you make a new 'style' with its own c-offsets-alist and add a line like:

(访问标签。+)

如果要从 bsd 样式,您可以执行以下操作:

If you want to derive from bsd style, you can do something like this:

(c-add-style "modified-bsd"
'("bsd"
  (c-basic-offset . 2)
  ;;...MORE MODS...
  (c-offsets-alist
   (access-label . +))))`

另外,我怎么找到要修改的偏移量?转到相关的代码行,然后按
C-c C-s 显示CC模式的语法分析。另外,请务必检查 c-offsets-alist 的帮助。

Also, how did I find the offset to modify? Go to the relevant line of code and press C-cC-s to show the syntactic analysis of CC-mode. Also be sure to check the help for c-offsets-alist.