[Rd] C basic indentation

From: Göran Broström <gb_at_stat.umu.se>
Date: Tue, 17 Feb 2009 23:03:50 +0100


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 () (ess-nuke-trailing-whitespace)))))
(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?

Göran

 > sessionInfo()
R version 2.8.1 Patched (2009-01-03 r47458) i686-pc-linux-gnu

locale:

LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;
LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;
LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

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

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Tue 17 Feb 2009 - 21:07:03 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 18 Feb 2009 - 07:30:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive