开发者

How to change brace indentation levels in Emacs?

开发者 https://www.devze.com 2022-12-25 04:58 出处:网络
I can\'t for the life of me find any answer to this through conventional Internet means, so I\'m hoping for some help.

I can't for the life of me find any answer to this through conventional Internet means, so I'm hoping for some help.

Emacs for me right now tends to do indentation on braces as follows:

if( ... )
  {

  }

Which I find incredibly irritating; I've never even seen this behaviour anywhere else. At any rate, the behaviour I'm expecting is,

if( ... )
{

}

If anyone knows how 开发者_JAVA技巧to modify this, it'd be greatly appreciated.


Basically you want:

(setq c-default-style "bsd"
  c-basic-offset 4)

For more indentation commands:

M-x c-set-style RET style RET

Select predefined indentation style style. Type ? when entering style to see a list of supported styles; to find out what a style looks like, select it and reindent some C code.

C-c C-o symbol RET offset RET

Set the indentation offset for syntactic symbol symbol (c-set-offset). The second argument offset specifies the new indentation offset.

source: http://www.phys.ufl.edu/docs/emacs/emacs_251.html

also: http://www.gnu.org/software/emacs/manual/html_node/ccmode/Indentation-Commands.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号