[ESS] Indentation level

Stephen Eglen S.J.Eglen at damtp.cam.ac.uk
Tue May 18 11:21:20 CEST 2010


> Sorry if I did not intervene in this thread. I did not realize I could
> be concerned. Yes, indeed, I set up my Emacs distribution so that the
> indentation level is 4 by default. From the site-start.el file: 
> 
> ;; Set code indentation following the standard in R sources.
> (setq-default c-default-style "bsd")
> (setq-default c-basic-offset 4)
> (add-hook 'ess-mode-hook
> 	  '(lambda()
> 	     (ess-set-style 'C++ 'quiet)
> 	     (add-hook 'write-file-functions
>                           (lambda ()
>                             (ess-nuke-trailing-whitespace)))))

hi Vincent,
by having:
   (ess-set-style 'C++ 'quiet)

in a mode hook, this will enforce users to the C++ indentation style,
despite the value of `ess-default-style'.

Not all your users may like that, so what I'd recommend instead is that
you have (or try):

(setq ess-default-style 'C++)
(add-hook 'ess-mode-hook
 	  '(lambda()
 	     (add-hook 'write-file-functions
                         (lambda ()
                          (ess-nuke-trailing-whitespace)))))


so that an end user can then put some other default in their .emacs
like:

(setq ess-default-style 'BSD)

and get 'the right thing'.

This should work even without the changes I added today.

Stephen



More information about the ESS-help mailing list