[ESS] How to control indentation in an R function?
Stephen Eglen
S.J.Eglen at damtp.cam.ac.uk
Thu Nov 26 14:40:16 CET 2009
Dear Michael,
Michael Hannon <jm_hannon at yahoo.com> wrote:
> Greetings. I'd like to have statements in R functions be indented by four
> spaces, as:
>
> fn <- function (x) {
> y <- x^2 #### this line is indented by four spaces
> }
>
> What I get is indentation by two spaces, as:
>
> fn <- function (x) {
> y <- x^2 #### this line is indented by two spaces
> }
>
It looks like our customizations are not working properly, as
ess-indent-level is customizable but is not being remembered. I will
investigate, but in the meantime, this should work for you:
put this in .emacs and restart Emacs:
(defun myindent-ess-hook ()
(setq ess-indent-level 4))
(add-hook 'ess-mode-hook 'myindent-ess-hook)
Stephen
More information about the ESS-help
mailing list