[Rd] C basic indentation

Göran Broström gb at stat.umu.se
Tue Feb 17 23:03:50 CET 2009

I use the recommendations in "R coding standards", i.e., I put

      ;;; C
      (add-hook 'c-mode-hook
                (lambda () (c-set-style "bsd")))
      ;;; ESS
      (add-hook 'ess-mode-hook
                (lambda ()
                  (ess-set-style 'C++ 'quiet)
                  (add-hook 'local-write-file-hooks
                            (lambda ()
      (setq ess-nuke-trailing-whitespace-p 'ask)
      ;;; Perl
      (add-hook 'perl-mode-hook
                (lambda () (setq perl-indent-level 4)))

into my .emacs file. IIRC, back in 2005 it gave me a basic indentation 
of 4 in C (good), but only 2 in R (not so good, but I fixed it with the 
aid of this excellent list). But now it gives me a basic indentation of 
eight (8!) in C code. This is not what I want. I think I saw somewhere 
that the bsd standard actually has changed from four to eight recently 
(but I cannot find it now).

Two points given that the standard really has changed: (i) The text in 
"R coding standards" should be changed accordingly. (ii) How do I get 
back to a basic indentation of 4 in C and R code?


 > sessionInfo()
R version 2.8.1 Patched (2009-01-03 r47458)


attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

GNU Emacs 22.2.1 on Ubuntu 8.10 x64
Göran Broström               phone: 46 90 786 5223; 46 705 197 507
Department of Statistics     fax: 46 90 786 6614
Umeå University              email: gb at stat.umu.se
SE-90187 Umeå, Sweden        http://tal.stat.umu.se/~gb

More information about the R-devel mailing list