[R] R indentation

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat May 17 14:59:04 CEST 2003


On Sat, 17 May 2003, Göran Broström wrote:

> I use Gnu emacs 21, Linux RH9 and R-1.7.0. I have succeeded to get the 
> recommended indentation of 4 in  C  thru customization as described in 
> 'R-exts', p.73, but I can't get it to work in  R  code. Can someone help, 
> for instance by sending me the appropriate lines in '.emacs'?

;;;-- Implement "R core indentation style"--------------------------------
(setq ess-mode-hook
      '(lambda()
	 (ess-set-style 'C++ 'quiet)

	 (add-hook 'local-write-file-hooks
		   '(lambda()
		      (nuke-trailing-whitespace)
		      ))
	 ))

(add-hook 'perl-mode-hook
	  '(lambda() (setq perl-indent-level 4)))

works for me, *provided* I have set (via customization)

(custom-set-variables
  ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 '(c-basic-offset 4)
 '(c-default-style "bsd"))


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list