indent levels

Liaw, Andy andy_liaw at merck.com
Mon Oct 4 15:26:25 CEST 2004


Found the answer:

(setq c-default-style "stroustrup")

or interactively: c-c .

Best,
Andy

> From: Liaw, Andy
> 
> Dear ESS-help,
> 
> Apologies for such an off-topic question:  The `Writing R 
> Extensions' manual
> has a snippet of elisp code that defines the indentation 
> style for R code.
> Can anyone tell me how to get C code to be indented similarly 
> in (X)Emacs?
> In particular, how do I get XEmacs to use four spaces for indentation,
> intead of the default of two spaces?  I tried:
> 
> (add-hook 'C-mode-hook
>           (lambda () 
> 	    (C-set-style 'C++)
>             ;; Because
>             ;;                                 DEF GNU BSD K&R C++
>             ;; C-indent-level                  2   2   8   5   4
>             ;; C-continued-statement-offset    2   2   8   5   4
>             ;; C-brace-offset                  0   0  -8  -5  -4
>             ;; C-arg-function-offset           2   4   0   0   0
>             ;; C-expression-offset             4   2   8   5   4
>             ;; C-else-offset                   0   0   0   0   0
>             ;; C-close-brace-offset            0   0   0   0   0
>             (add-hook 'local-write-file-hooks
>                       (lambda ()
>                         (nuke-trailing-whitespace)))))
> 
> but when I load a .c file, XEmacs complained about unknown 
> style "C++".
> 
> I'd very much appreciate any pointer.
> 
> Best,
> Andy
> 
> Andy Liaw, PhD
> Biometrics Research      PO Box 2000, RY33-300     
> Merck Research Labs           Rahway, NJ 07065
> andy_liaw <at> merck.com          732-594-0820
> 
> ______________________________________________
> ESS-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
> 
> --------------------------------------------------------------
> ----------------
> Notice:  This e-mail message, together with any attachments, 
> contains information of Merck & Co., Inc. (One Merck Drive, 
> Whitehouse Station, New Jersey, USA 08889), and/or its 
> affiliates (which may be known outside the United States as 
> Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as 
> Banyu) that may be confidential, proprietary copyrighted 
> and/or legally privileged. It is intended solely for the use 
> of the individual or entity named on this message.  If you 
> are not the intended recipient, and have received this 
> message in error, please notify us immediately by reply 
> e-mail and then delete it from your system.
> --------------------------------------------------------------
> ----------------
>




More information about the ESS-help mailing list