[ESS] Indentation level

Stephen Eglen S.J.Eglen at damtp.cam.ac.uk
Tue May 18 11:12:36 CEST 2010


Dear all,

I've now included new documention and code to make it clearer how to
change ESS indentation styles.  This is now in the SVN repository.
With this version , you can do

M-x customize-variable RET ess-own-style-list to get an easy way to
change individual indentation variables.  (If you use this method, make
sure you also set ess-default-style to 'OWN).

This should be part of ESS 5.9

Stephen
----------------------------------------------------------------------


7.5.1 Changing indentation styles
---------------------------------

The combined value of nine variables that control indentation are
collected termed a style.  ESS provides several styles covering the
common styles of indentation: `DEFAULT', `OWN', `GNU', `BSD', `K&R',
`C++', `RRR', `CLB'.  The variable `ess-style-alist' lists the value of
each indentation variable per style.

   If you wish to change from one predefined style to another, change
the variable `ess-default-style', for example:

     (setq ess-default-style 'C++)

   The styles `DEFAULT' and `OWN' are initially identical.  If you wish
to edit some of the default values, set `ess-default-style' to `'OWN'
and change `ess-own-style-list'.  *Note Customization::, for convenient
ways to set both these variables.

   If you prefer not to use the custom facility, you can change
individual indentation variables within a hook, for example:

     (defun myindent-ess-hook ()
       (setq ess-indent-level 4))
     (add-hook 'ess-mode-hook 'myindent-ess-hook)

   In the rare case that you'd like to add an entire new indentation
style of your own, copy the definition of `ess-own-style-list' to a new
variable and ensure that the last line of the `:set' declaration calls
`ess-add-style' with a unique name for your style (e.g. `'MINE').
Finally, add `(setq ess-default-style 'MINE)' to use your new style.



More information about the ESS-help mailing list