[ESS] outline-minor-mode

Heinz Tuechler tuechler at gmx.at
Fri May 11 11:29:59 CEST 2007


More than a year later and with the help of Stefan Monnier at
help-gnu-emacs, I found one way to adapt outline-minor-mode to R-comments.
A first line in an R-syntax file like the following has the effect to treat
comments with ##### as level 1 headlines, #### as level 2 headlines, and
### as level 3 headlines.

#### -*- mode: R ; mode:outline-minor; outline-regexp:"#\\{2,5\\} ";
outline-level: (lambda () (interactive) (cond ((looking-at "##### ")
1)((looking-at "#### ") 2)((looking-at "### ") 3)((looking-at "## ") 4)  (t
1000))) -*-

Together with outline-magic this is convenient for me.

Heinz

At 11:18 04.02.2006 +0100, Heinz Tuechler wrote:
>Thanks to Seth Falcon, Stephen Eglen, Tony Rossini for your helpful
>answers. I will try it and see what I like most.
>
>Heinz
>
>At 10:49 04.02.2006 +0100, A.J. Rossini wrote:
>>Stephen's approach is what I do to use allout mode (require
>'allout).
>>
>>To test, set the header lead string to "###" (there's a menu
>pull-down
>>to set this as one of the options).
>>
>>best,
>>-tony
>>
>>On
>2/4/06, Stephen Eglen <S.J.Eglen at damtp.cam.ac.uk> wrote:
>>>  >
>>>  > maybe
>I missed some ESS functionality, but I considere to use
>>>  >
>outline-minor-mode in R syntax buffers. I would like to use the comment
>>>
>> lines as headings. The problem I don't know to solve is that in R
>usually
>>>  > comments starting with ### are considered as higher level
>than comments
>>>  > starting with ## or #.
>>>
>>> yes, and that follows the
>elisp convention for comments.
>>>  > As far as I understood outline-mode
>would treat them the other way round i.e.
>>>  > # comment would be
>considered as top level, ## comment as second,
>>>  and so on.
>>>
>>> Yes.
>outline-regexp is a variable that controls what regexp is used to
>>> find
>headers at the start of a line. So, three hashes would be taken
>>> as a
>level 3 heading, deeper than one hash (level one).  I just took a
>>> quick
>look in the elisp, and couldn't see a way to specify the level
>>>
>separately from the regexp.
>>>
>>> Furthermore, if you use ESS's indenting,
>you'd see that comments with
>>> either one or two hashes won't be found at
>the start of the line,
>>> which might mess things up.
>>>
>>> Possibly the
>solution would be to use three hashes followed by some
>>> variable number
>of asterisks to denote your header:
>>>
>>> ### * Init code
>>>
>>> ### ** New
>vars
>>>
>>> Stephen
>>>
>>> ______________________________________________
>>>
>ESS-help at stat.math.ethz.ch mailing list
>>>
>https://stat.ethz.ch/mailman/listinfo/ess-help
>>>
>>
>>
>>--
>>best,
>>-tony
>>
>>b
>lindglobe at gmail.com
>>Muttenz, Switzerland.
>>"Commit early,commit often, and
>commit in a repository from which we can easily
>>roll-back your mistakes"
>(AJR, 4Jan05).
>>
>
>______________________________________________
>ESS-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/ess-help
>
>




More information about the ESS-help mailing list