C Comment in Emacs - Linux Kernel Style

北慕城南 提交于 2019-12-06 04:38:47

问题


I'm using

(setq-default comment-style 'multi-line)

and my region comments, when doing M-;, are:

/* void main()
 * {
 *  int i;
 *  int b;
 *  printf("format string");
 * } */

But I want them to look like this:

/* 
 * void main()
 * {
 *  int i;
 *  int b;
 *  printf("format string");
 * }
 */

What do I have to change?


回答1:


Try with:

(setq comment-style 'extra-line)



回答2:


Complementing the anler answer and answering my own question.

To use the Linux Kernel commenting Style [1] in emacs, just set this variable in your .emacs/init.el:

(setq comment-style 'extra-line)

To comment/uncomment use M-; after select the region.

To fix needless comment spaces when using tabs see C Comment in Emacs - Linux Kernel Style v2.

[1] https://www.kernel.org/doc/Documentation/CodingStyle



来源:https://stackoverflow.com/questions/23172561/c-comment-in-emacs-linux-kernel-style

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!