all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Making outline-minor-mode's outline-regexp more flexible
@ 2018-12-29  4:15 Mark Edgington
  2018-12-29  7:25 ` Eli Zaretskii
  2018-12-29 21:28 ` Juri Linkov
  0 siblings, 2 replies; 8+ messages in thread
From: Mark Edgington @ 2018-12-29  4:15 UTC (permalink / raw)
  To: emacs-devel

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



^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: Making outline-minor-mode's outline-regexp more flexible
@ 2019-01-09  2:52 Mark Edgington
  2019-01-09  2:56 ` Mark Edgington
  2019-01-09  3:10 ` Stefan Monnier
  0 siblings, 2 replies; 8+ messages in thread
From: Mark Edgington @ 2019-01-09  2:52 UTC (permalink / raw)
  To: monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 185 bytes --]

> I don't see why outline-level would need to do any matching.

How would you compute the outline level of 2 for "  // ***", and level
3 for both "     // ****" and ” // ****”?

[-- Attachment #2: Type: text/html, Size: 259 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-01-09  3:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-29  4:15 Making outline-minor-mode's outline-regexp more flexible Mark Edgington
2018-12-29  7:25 ` Eli Zaretskii
2018-12-29 21:28 ` Juri Linkov
2018-12-30  2:24   ` Mark Edgington
2019-01-02  1:59     ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2019-01-09  2:52 Mark Edgington
2019-01-09  2:56 ` Mark Edgington
2019-01-09  3:10 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.