Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ESS set tab whitespace level?

Tags:

emacs

r

ess

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(!).

like image 860
hatmatrix Avatar asked Jul 12 '13 06:07

hatmatrix


1 Answers

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).

like image 161
VitoshKa Avatar answered Sep 21 '22 23:09

VitoshKa