[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ess-help
Subject:    Re: [ESS] Indentation level
From:       Stephen Eglen <S.J.Eglen () damtp ! cam ! ac ! uk>
Date:       2010-05-18 9:21:20
Message-ID: 8812.1274174480 () maps
[Download RAW message or body]


> 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

______________________________________________
ESS-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic