[TriLUG] emacs question

Tanner Lovelace clubjuggler at gmail.com
Wed May 30 09:20:11 EDT 2007


On 5/30/07, Brian Templeton <bpt at tunes.org> wrote:

> 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)))


Close, but what I think he's really asking about is this:

  (c-set-offset 'substatement-open 0)

Here's what I have in my .emacs

(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
(defun my-c-mode-common-hook ()
  (setq indent-tabs-mode nil)             ;; don't insert tabs
  (turn-on-font-lock)
;;  (local-set-key "\C-cd"    'ctypes-define-type)
;;  (local-set-key "\C-ce"    'ctypes-edit)
  (local-set-key "\C-l" 'recenter)
  (local-set-key '[A-mouse-1] 'find-tag)
  (setq c-basic-offset 2)
  (c-set-offset (quote arglist-intro) (quote +) nil)
  (c-set-offset 'substatement-open 0)
  (c-set-offset 'case-label '+)
  (setq c-block-comments-indent-p 3))

Cheers,
Tanner
-- 
Tanner Lovelace
clubjuggler at gmail dot com
http://wtl.wayfarer.org/
(fieldless) In fess two roundels in pale, a billet fesswise and an
increscent, all sable.



More information about the TriLUG mailing list