On Thu, 4 May 2017, Ista Zahn wrote:

On Thu, May 4, 2017 at 10:25 AM, Lionel Henry <lionel....@gmail.com> wrote:

On 4 mai 2017, at 16:22, Paul Johnson <pauljoh...@gmail.com> wrote:

I understand I can fix my init.el go avoid this, but it would be nicer
for my purpose
if this were in ESS itself, because I keep telling students to use it
and they are put off/discouraged
by this.

Emacs is for people willing to put the effort into customisation.
Your students are probably better off with RStudio. That said
I agree that good defaults are important.

And there are a bunch of styles from which to choose a personal default. See below.

Yes, IMO Emacs/ESS isn't going to compete with Rstudio on
out-of-the-box convenience. But we can compete on features! Put this
in your config file

(add-hook 'ess-mode-hook
           ;; don't indent comments
           (setq ess-indent-with-fancy-comments nil)
           ;; turn on outline mode
           (setq-local outline-regexp "[# ]+")
           (outline-minor-mode t)))

and not only will single # comments not be aligned at comment-column,
but code folder will work too!

There are `off-the-shelf' styles like `Rstudio' that might satisfy Paul's student.

Setting `ess-default-style' to `Rstudio' gives these settings:

  (ess-indent-offset . 2)
  (ess-offset-arguments . open-delim)
  (ess-offset-arguments-newline . prev-line)
  (ess-offset-block . prev-line)
  (ess-offset-continued . straight)
  (ess-align-arguments-in-calls "function[         ]*(")
  (ess-indent-from-lhs arguments)
  (ess-indent-from-chain-start . t)

Or one can customize the `OWN' style and select it. See the `ess-style-alist' docstring for more details.



ESS-help@r-project.org mailing list

Reply via email to