emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Making outline-minor-mode's outline-regexp more flexible


From: Mark Edgington
Subject: Making outline-minor-mode's outline-regexp more flexible
Date: Fri, 28 Dec 2018 23:15:52 -0500

Currently when using outline-minor-mode, the outline-regexp variable
defines a regexp used to match headlines.  The way that it is
currently treated is that the entirety of the match is considered part
of the headline.  The problem with this is that
it prevents specifying headlines in this way:

// * first headline
  if (foo) {
    // ** second headline
    ...
  }

Instead, in order for org-mode like features (e.g.
promoting/demoting/folding/moving headlines) to work, all headlines
currently are assumed to start at the first column -- there can't be
any preceding whitespace, because such whitespace is treated as part
of the headline, and affects the outline depth of the headline. Having
the headline start at the first column can reduce the readability of
the code that it is placed in.

One way this could be improved is by making it so that if
outline-regexp contains a group to be matched, then only the text
matched by the group determines the outline depth, instead of the text
matched by the full regular expression.

Would there be issues with changing the meaning of outline-regexp in
this way?  If so, would it be possible to add an auxiliary variable
that determines how the regexp is to be interpreted?

What do you all think?  I don't suspect that the implementation of
this would be too much work, and the benefit of being able to have
indented headlines might be worthwhile.  This is especially important
when collaborating on code with others who aren't using emacs.

Regards,

Mark



reply via email to

[Prev in Thread] Current Thread [Next in Thread]