Subject: Emacs and coding style

From: Marcus Lundblad <[email-masked]>
Date: Sun, 6 Jul 2003 23:51:40 +0200 (CEST)

Is it possible to change the behaviour of the C mode in Emacs?
It normally indents brases 2 columns from the "parent" line (if, while
etc.)
Or is there some alternative C mode recommended?

//Marcus

--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Dan Espen <[email-masked]>
Date: Sun, 06 Jul 2003 18:24:32 -0400

> Or is there some alternative C mode recommended?

Here's what I currently use.  (The second part are my own
settings which don't match what Fvwm uses.)

(defun my-c-mode-hook ()
  (if (string-match "fvwm" buffer-file-name) ;fvwm project settings:
      (progn
	(setq
	 c-indent-level 8
	 c-basic-offset 8
	 c-brace-offset 0
	 c-continued-brace-offset 0
	 c-brace-imaginary-offset 0
	 c-continued-statement-offset 0
	 c-label-offset 0
	 c-argdecl-indent 0
	 c-auto-newline nil
	 c-tab-always-indent t
	 indent-tabs-mode t)
	 (c-set-offset 'substatement-open 0))
    (setq 
     c-indent-level 2 ; Indent inside block
     c-basic-offset 2
     c-brace-offset 0 ; for braces, compared with other text in same context
     c-continued-brace-offset 0 ; Extra for substatements start with open-braces
     c-brace-imaginary-offset 0
     c-continued-statement-offset 2 ; Extra for lines not starting new stmts
     c-label-offset -2 ; Offset of label, case relative to usual indentation
     c-argdecl-indent 0 ; Indentation level of C function arguments
     c-auto-newline nil ; Non-nil automatically newline before and after braces
     c-tab-always-indent t
     indent-tabs-mode nil
     comment-column 40)))
(add-hook 'c-mode-hook 'my-c-mode-hook t)

-- 
Dan Espen                           E-mail: [email-masked]