GNU bug report logs - #53981
28.0.91; shortdoc: Add support for outline-minor-mode

Previous Next

Package: emacs;

Reported by: Daniel Mendler <mail <at> daniel-mendler.de>

Date: Sun, 13 Feb 2022 22:40:02 UTC

Severity: wishlist

Found in version 28.0.91

Fixed in version 29.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #35 received at 53981 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Mendler <mail <at> daniel-mendler.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Juri Linkov <juri <at> linkov.net>
Cc: 53981 <at> debbugs.gnu.org,
 Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
Subject: Re: bug#53981: 28.0.91; shortdoc: Add support for outline-minor-mode
Date: Thu, 17 Feb 2022 14:44:20 +0100

On 2/17/22 12:43, Lars Ingebrigtsen wrote:
> Juri Linkov <juri <at> linkov.net> writes:
> 
>> Is this a promising direction?
> 
> [...]
> 
>> +  (setq-local outline-level (lambda () (if (eq (char-after) ?\() 2 1)))
>> +  (setq-local outline-search-function
>> +              (lambda (&optional looking-at)
>> +                (save-excursion
>> +                  (let* ((prop-at (if looking-at
>> +                                      (get-text-property (point) 'shortdoc-section)
>> +                                    t))
>> +                         (prop-match (and prop-at (text-property-search-forward 'shortdoc-section))))
>> +                    (when prop-match
>> +                      (set-match-data (list (prop-match-beginning prop-match)
>> +                                            (prop-match-end prop-match)))
>> +                      t))))))
> 
> No, I was thinking that modes like this would just put a text property
> like `outline-heading' (or even just `heading') on the heading, and then
> outline-minor-mode would use that.
> 
> I.e., we make modes that generate buffers provide semantics for the data
> it's inserted, and then outline-minor-mode reacts to those semantics.

I think Juri's approach to provide a search function is better, since it
gives more flexibility. At least please don't hard code the
`outline-heading` property. Then one could use different properties and
retroactively enable outline minor mode for modes which don't come with
the outline-heading property. Maybe support a list of properties which
indicate headlines? But at that point a function may just be simpler...

Daniel





This bug report was last modified 2 years and 183 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.