[ESS] Certain lines confuse indentation

Stephen Weigand weigand.stephen at gmail.com
Mon Nov 16 16:13:16 CET 2009


Hi,

I love ESS and have upgraded from 5.3.7 to 5.5. I have R code that
confuses the automatic indentation in 5.5. It's an obscure problem
and I can work around it, but here's a report (for what it's worth).

I sometimes use R to write long strings which go into a report. In
the editing buffer I insert line breaks and other white space to
make the strings more readable. I do something like this:

wrap <- function(x){
 strwrap(x, width = 1000)
}

a <- wrap("blah
  blah
  blah")

The above doesn't confuse the indentation in that this is fine:

plot(x,
     y) # ess-indent-command & newline-and-indent work


But these cause trouble

# 1. Line beginning with paren
wrap("Blah
(blah)
  blah")

# 2. Line beginning with brace
wrap("Blah
(blah)
  blah")

where by "trouble", I mean

plot(x,
y) # ess-indent-command & newline-and-indent do not work

I didn't have this issue in 5.3.7. The workaround is easy: just don't start
lines with "(", or "}" when they are in the middle of a string.

Thanks,

Stephen
-- 
Rochester, Minn. USA



More information about the ESS-help mailing list