[ESS] indentation of continued statements

Sebastian P. Luque spluque at gmail.com
Mon Apr 7 23:09:48 CEST 2008


On Fri, 13 Apr 2007 13:02:58 -0400 (EDT),
"Richard M. Heiberger" <rmh at temple.edu> wrote:

> C-h v ess-default-style 

I'm using ESS 5.3.6 on GNU Emacs 23.0.60.1 (x86_64-pc-linux-gnu, GTK+
Version 2.12.9) of 2008-04-06 on elegiac, modified by Debian.  I'm
following the recommendations in R extensions manual:

,-----[ (info "(R-ints)R coding standards") lines: 2057 - 2082 ]
|      ;;; C
|      (add-hook 'c-mode-hook
|                (lambda () (c-set-style "bsd")))
|      ;;; ESS
|      (add-hook 'ess-mode-hook
|                (lambda ()
|                  (ess-set-style 'C++)
|                  ;; Because
|                  ;;                                 DEF GNU BSD K&R C++
|                  ;; ess-indent-level                  2   2   8   5   4
|                  ;; ess-continued-statement-offset    2   2   8   5   4
|                  ;; ess-brace-offset                  0   0  -8  -5  -4
|                  ;; ess-arg-function-offset           2   4   0   0   0
|                  ;; ess-expression-offset             4   2   8   5   4
|                  ;; ess-else-offset                   0   0   0   0   0
|                  ;; ess-close-brace-offset            0   0   0   0   0
|                  (add-hook 'local-write-file-hooks
|                            (lambda ()
|                              (ess-nuke-trailing-whitespace)))))
|      (setq ess-nuke-trailing-whitespace-p 'ask)
|      ;; or even
|      ;; (setq ess-nuke-trailing-whitespace-p t)
|      ;;; Perl
|      (add-hook 'perl-mode-hook
|                (lambda () (setq perl-indent-level 4)))
`-----


but this results in indentation of continued statements in an
expression that is hard to read, e.g.:

xyplot(y ~ x | k, data=dat,
       scales=list(alternating=1,
       rot=0, tck=c(1, 0)))

i.e. it's hard to see that the last line is a continuation of the list()
call to the argument 'scales'.  In some previous ESS version (with the
same settings), this used to be indented as:

xyplot(y ~ x | k, data=dat,
       scales=list(alternating=1,
                   rot=0, tck=c(1, 0)))

which is a lot easier to read.  I cannot locate the variable that
controls this, while staying within the recommendations in the R
extensions manual.  Any idea what this variable might be?



Cheers,

-- 
Seb




More information about the ESS-help mailing list