[TriLUG] emacs question
Brian Templeton
bpt at tunes.org
Wed May 30 09:14:45 EDT 2007
"Andrew Ball" <anball at gmail.com> writes:
> Does anyone know how I can get emacs to not insert extra spaces before
> opening curly braces that start on the line after the if, for, etc.
> statement that
> they go with?
>
> That is, I get
>
> if (foo)
> {
> /* do something */
> }
>
> when I really want
>
> if (foo)
> {
> /* do something */
> }
>
> This is in C mode.
>
> It looks like there may be something in c-offsets-alist, to change,
> but I'm a bit lost. Any hints would be appreciated.
>
Hello Andrew,
You probably want to change CC Mode's C coding style to something
other than the default of "gnu". Styles are documented in (info
"(ccmode)Styles"), and the built-in styles are listed in (info
"(ccmode)Built-in Styles"). From your example, it looks like you want
to use the BSD style with a four-space indent; to do this by default
in C mode, you can add the following form to your .emacs:
(add-hook 'c-mode-hook (lambda ()
(c-set-style "bsd")
(setq c-basic-offset 4)))
More information about the TriLUG
mailing list