[ESS] indentation when using = rather than <-
Tim Hesterberg
timh at insightful.com
Fri Feb 3 23:27:37 CET 2006
I'm trying to move away from using _ for assignment, but
rather than <- I want to use =
(for a number of reasons, the biggest of which is that <- is
a barrier to new users adopting the S language).
Unfortunately, ESS does not treat <- and = the same for
indentation (example below).
How would I get ESS to treat "=" the same as "<-" for purposes
of indentation?
I tried adding "=" to the ess-S-assign-ops variable, but that
didn't seem to affect indentation. There is a comment in the
definition of the variable suggesting the omission of "="
is intentional, so I'm wondering about possible negative ramifications
of modifying the ESS code to make indentation work as I like.
--------------------------------------------------
Example:
If I create the following functions with
no initial blanks, then run ess-indent-exp from the beginning
of each function, I get the following; I'd like indenting the
second version to be similar to indenting the first.
f <- function(x){
a
if(b){
c <- foo1(x = 2, y = 3, foo2(z = mean(x)),
a, b = 5)
for(i in 1:n)
d[i] <- foo3(z, foo4(a = 3,
b =
5, c, foo5(d)))
}
}
f = function(x){
a
if(b){
c = foo1(x = 2, y = 3, foo2(z = mean(x)),
a, b = 5)
for(i in 1:n)
d[i] = foo3(z, foo4(a = 3,
b =
5, c, foo5(d)))
}
}
More information about the ESS-help
mailing list