简体   繁体   English

Emacs改变了c编码风格

[英]Emacs changing c coding style

How do i change the c coding style format in emacs ? 如何在emacs中更改c编码样式格式? Specifically i need to change the indentation in the c code shown by emacs from i per block to 2 per block 具体来说,我需要将emacs显示的c代码中的缩进从每个块更改为每个块2个

Type Mx followed by "customize-mode" followed by "c-mode". 键入Mx,然后键入“customize-mode”,接着是“c-mode”。 Then use the built-in customization page to override the default "C Basic Offset" with your new value of "2". 然后使用内置的自定义页面覆盖默认的“C Basic Offset”,新值为“2”。 When you're done, be sure to select "Save for future sessions" at the top of the page. 完成后,请务必在页面顶部选择“保存以后的会话”。

Among the built-in indentation styles, "gnu" has an indentation width of 2 characters. 在内置缩进样式中,“gnu”的缩进宽度为2个字符。 You can choose an indentation style with c-set-style , bound to Cc . 您可以选择c-set-style的缩进c-set-style ,绑定到Cc .

Take a look at http://code.google.com/p/google-styleguide/ 看看http://code.google.com/p/google-styleguide/
There is ready to use macro. 有准备使用宏。 You can customize it if you want. 您可以根据需要自定义它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM