![](https://csdnimg.cn/release/download_crawler_static/43798987/bg4.jpg)
M-x c-mode :进入 C mode模式
M-x c++-mode :进入 C++ 模式
M-a:移动到当前语句的开头
M-e:移动到当前语句的结尾
M-q:如果光标在注释中,则填充段落,同时保留缩进等
C-M-a:移动到所在函数的开头
C-M-e:移动到函数末尾
C-M-h:移动光标到函数开头,并标记函数末尾
C-c C-q :缩进整个函数
C-c C-u :移动到当前预处理条件的开头
C-c C-p :移动到上一条预处理条件
C-c C-n :移动到下一条预处理条件
M-x c-set-style :选择编码风格。内建的 cc-mode 缩进风格
bsd:Style used in code for BSD-derived versions of Unix.
cc-mode:The default coding style, from which all others are derived .
ellemtel :Style used in C++ documentation from Ellemtel Telecommunication Systems
Laboratories in Sweden .
gnu:Style used in C code for Emacs itself and other GNU-related programs .
java :Style used in Java code (the default for Java mode).
k&r :Style of the classic text on C, Kernighan and Ritchie's The C Programming
Language .
linux :Style used in C code that is part of the Linux kernel.
python :Style used in python extensions.
stroustrup :C++ coding style of the standard reference work, Bjarne Stroustrup's
The C++ Programming Language .
user :Customizations you make to .emacs or via Custom (see Chapter 10). All other
styles inherit these customizations if you set them.
whitesmith :Style used in Whitesmith Ltd.'s documentation for their C and C++
compilers .
:调整代码风格
C-c k&r :k&r 代码风格。设置后,需要调用 调整代码风格
C-c C-a :打开 / 关闭 c-toggle-auto-state 。是否自动插入 newline
C-c C-d:打开 / 关闭 c-toggle-hungry-state 。在 Del(maybe BackSpace) 时,是否自动删
除左边所有空格
C-c C-t :同时打开 / 关闭 auto-newline 和 hungry-delete-key 功能