[ESS] Ever consider changing indentation on #?

Paul Johnson pauljohn32 at gmail.com
Fri Jun 23 21:34:35 CEST 2017

On Mon, May 15, 2017 at 9:17 AM, Martin Maechler
<maechler at stat.math.ethz.ch> wrote:
>>>>>> Lionel Henry <lionel.hry at gmail.com>
>>>>>>     on Sat, 6 May 2017 12:30:40 +0200 writes:
>     > I don't use it either (though I tried at some point).
>     > Any objection to change the default Martin?
> Yes !!
>     > Lionel

There's still no good solution for the problem that, when somebody
sends you an R markdown document, the thing they use for a major
section, a flush left "#", is pushed off to right by ESS.

I'm testing changes in my init file. I have not found the right recipe
yet, but if I could, I think it will match the needs of all of us.
Here's what I'm trying for:

1 IF the # is currently in column 1, leave it there.

2 IF the # is on the right of some text, then do the thing that happens now.

I believe this would solve the matter entirely. None of you who like the # for
right side comments want to put the # in column 1.

If you have ideas to try, I will test.

Right now I'm experimenting with Ista's suggestion:

(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)))

That solves the "one # flies to the right" problem, but does not achieve goal 2.

I cannot tell if it alters the behavior of other indentation, however.
it seems it might

Paul E. Johnson   http://pj.freefaculty.org
Director, Center for Research Methods and Data Analysis http://crmda.ku.edu

To write to me directly, please address me at pauljohn at ku.edu.

More information about the ESS-help mailing list