在Emacs cc模式中删除样式:(冒号)?

时间:2015-10-17 21:21:52

标签: emacs elisp

我想删除冒号样式,通常显示为:

goto:

添加冒号样式的代码从line 457开始。

没有必要,但如果我只能在某些目录中删除冒号样式会很好:

  • /root/project/hi.c
  • /root/project_remove_colon/hi.c

谢谢!

1 个答案:

答案 0 :(得分:1)

执行此操作的一种方法是将c-label-face-name设置为文件局部变量。例如,在文件/root/project_remove_colon/hi.c中,您可以在文件末尾添加以下注释块:

/* Local Variables: */
/* c-label-face-name: font-lock-reference-face */
/* End: */

这种方法的一个问题是,c-label-face-namenot considered safe as a file-local variable,因此当您访问该文件时,emacs会提示您:

The local variables list in hi.c
contains variables that are risky (**).

Do you want to apply it?  You can type
y  -- to apply the local variables list.
n  -- to ignore the local variables list.

** c-label-face-name : font-lock-reference-face

要避免此提示,您可以customize safe-local-variable-values将变量c-label-face-name标记为安全。