I thought you set the level of indentation with
(setq ess-indent-level 2)
But I keep getting 4 spaces. For instance, I used to write
foo <- function(x)
x + 2
But now, ESS puts the second line 4 spaces away from the left margin
foo <- function(x)
x + 2
Has something changed between the new and old versions? I used to use ESS 5.11 and just upgraded to 13.05(!).
Yes, many things have changed since 5.11. The default indentation style now follows R
standard 4 spaces for indentation. Choose the best style from ess-style-alist
and set ess-default-style
:
(setq ess-default-style 'OWN)
To return to old default and make the settings honor individual variables like
ess-indent-level
add this:
(setq ess-default-style 'DEFAULT)
Somewhat confusing, the name DEFAULT comes from default-value
, that is the style
is build from the default settings of indentation variables like
ess-indent-level
, ess-arg-function-offset
, ess-brace-offset
etc.
FWIW, you can change indentation syles interactively with C-c . (C-c C-e C-s as of 2014).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With