[ESS] how to make close-parens indent identically to close-brace?

Kevin Ushey kevinushey at gmail.com
Mon Dec 8 05:24:20 CET 2014


Hi Murat,

There was a new option added for this recently -- see
`ess-dont-vertically-align-closing-paren`. You can use `(setq
ess-dont-vertically-align-closing-paren t)` to toggle it.

FWIW, I have this in my `.emacs` to configure the ESS indentation to
my liking; it should give you a starting place to configure for your
own preferences.

(setq ess-ac-R-argument-suffix " = ")
(setq ess-use-auto-complete t)
(add-hook 'ess-mode-hook
          (lambda ()
            (local-set-key (kbd "<s-return>") 'ess-eval-region-or-line-and-step)
            (show-paren-mode t)
            (setq ess-indent-level 2)
            (setq ess-first-continued-statement-offset 2)
            (setq ess-continued-statement-offset 0)
            (setq ess-arg-function-offset 2)
            (setq ess-arg-function-offset-new-line 2)
            (setq ess-dont-vertically-align-closing-paren t)
           ))
(ess-toggle-underscore nil)

Cheers,
Kevin

On Sun, Dec 7, 2014 at 6:53 PM, Murat Tasan <mmuurr at gmail.com> wrote:
> Hi all ---
>
> Does anyone know how to force ESS to treat closing parentheses like
> closing braces when writing multi-line statements?
>
> An example is:
>
> ## existing default indentation
> list(
>     a = 1:10,
>     b = 10:1,
>     )
>
> But in such cases, where the open-parens is followed immediately by
> whitespace/newline, I'd really like the indentation to be like braces.
> I'd settle with just having the closing parens match up to the start
> of the call, rather than the open-parens, though:
>
> ## treating parens a bit more like braces
> list(
>   a = 1:10,
>   b = 10:1,
> )
>
> Has anyone ever written such a modification for ESS?
> (My Elisp is nowhere near sophisticated-enough to know how to specify
> this type of rule myself :-/ )
>
> Cheers,
>
> -murat
>
> ______________________________________________
> ESS-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help



More information about the ESS-help mailing list