Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # I've been unhappy with ESS indention for some time, and finally got
- # around to trying to adjust it to my taste. It didn't go well, and so
- # I'm turning to the collective wisdom of this list for help.
- #
- # I don't think what I want is so exotic; basically I like how Rstudio
- # indents things, which mostly means lining up things up by reference to
- # the calling function. Here are some examples (these examples also
- # available at __________ in case your email client doesn't like to use
- # a fixed-width font):
- #Rstudio:
- mean(rnorm(100,
- mean = runif(1,
- 1,
- 10)),
- na.rm=TRUE
- )
- # ESS
- mean(rnorm(100,
- mean = runif(1,
- 1,
- 10)),
- na.rm=TRUE
- )
- # The Rstudio version makes it easy to see which lines are arguments to
- # which functions, and I'd like to set ESS to use a similar indentation
- # style. I've fiddled with all the ess.*offset variables I can find, but
- # I can't seem to find a satisfactory setting.
- #
- # The biggest annoyance is the indentation of continuation lines. There
- # have been several posts about this including
- # http://emacs.1067599.n5.nabble.com/indentation-of-ggplot-code-and-ess-13-09-02-td322315.html
- # which suggests the following setting:
- # (add-to-list 'ess-style-alist
- # '(my-style
- # (ess-indent-level . 4)
- # (ess-first-continued-statement-offset . 2)
- # (ess-continued-statement-offset . 0)
- # (ess-brace-offset . -4)
- # (ess-expression-offset . 4)
- # (ess-else-offset . 0)
- # (ess-close-brace-offset . 0)
- # (ess-brace-imaginary-offset . 0)
- # (ess-continued-brace-offset . 0)
- # (ess-arg-function-offset . 4)
- # (ess-arg-function-offset-new-line . '(4))
- # ))
- #This does improve simple examples such as turning this:
- 1 +
- 2 +
- 3 +
- 4
- into
- 1 +
- 2 +
- 3 +
- 4
- # though I would really like
- 1 +
- 2 +
- 3 +
- 4
- # But it still leave more complicated things like
- mean(rnorm(100)) +
- 2 +
- mean(rnorm(100,
- mean = runif(1, 1, 10)), na.rm=TRUE) +
- 2 +
- 2
- # I really don't understand why it makes sense to indent the "2's"
- # differently depending on whether they come before or after the second
- # "mean(rnorm(...". Compare this to the Rstudio indentation:
- mean(rnorm(100)) +
- 2 +
- mean(rnorm(100,
- mean = runif(1, 1, 10)), na.rm=TRUE) +
- 2 +
- 2
- # Right. So I hate to be that guy, but seriously, how can I make ESS
- # indentation behave more like Rstudio?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement