[ESS] indentation not working if parentheses are already closed

Ista Zahn istazahn at gmail.com
Tue Apr 16 14:58:57 CEST 2013


Hi Jannis,

On Tue, Apr 16, 2013 at 4:32 AM, Jannis <bt_jannis at yahoo.de> wrote:
> Dear ess community,
>
>
> usually the automatic indentation in ess works like a charm. I have however,
> experienced that it does not work in case I add a newline and the matching
> parenthesis is already closed. E.g. hitting Return after
>
>
> foo = function() {
>
>
> would indent the following line correctly, but placing the cursor between
> the two curly braces here:
>
> foo = function() {<cursor here>}
>
> and hitting enter, results in a non indented new line. Is this a bug? Or
> intended?

This behavior is consistent. In the first case:

foo <- function() {

pressing enter does start an indented line, but completing the
function shows that the closing bracket is not indented, i.e.,
pressing enter and inserting the closing brace results in:

foo <- function() {
}


In the second case you insert the closing bracket and press enter,
which gives you the same thing. If you start typing the body of the
function and press tab it will indent correctly, i.e., if I type
'print("bar")<TAB> I end up with

foo <- function() {
  print("bar")}

Or is there a way to switch it off?

Not sure, but the relevant variables are ess-default-style and
ess-own-style-list. See
http://stackoverflow.com/questions/12805873/changing-indentation-in-emacs-ess
for a description of the built-in styles. If none of those satisfy,
set ess-default-style to 'own' and customize ess-own-style-list.

Best,
Ista

>
> I ask as I just installed smartparens.el which creates balanced parentheses
> automatically and, hence, would switch off the really helpful indentation
> behavior.
>
>
> Cheers
> jannis
>
>
> P.S. Sorry for crossposting to gnu-emacs-help, ... I realized after
> submitting the mail that ess-help would be the more appropriate list.
>
> ______________________________________________
> ESS-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help



More information about the ESS-help mailing list