[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#53981: 28.0.91; shortdoc: Add support for outline-minor-mode
From: |
Daniel Mendler |
Subject: |
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@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
- bug#53981: 28.0.91; shortdoc: Add support for outline-minor-mode, Daniel Mendler, 2022/02/13
- bug#53981: 28.0.91; shortdoc: Add support for outline-minor-mode, Lars Ingebrigtsen, 2022/02/14
- bug#53981: 28.0.91; shortdoc: Add support for outline-minor-mode, Kévin Le Gouguec, 2022/02/15
- bug#53981: 28.0.91; shortdoc: Add support for outline-minor-mode, Lars Ingebrigtsen, 2022/02/15
- bug#53981: 28.0.91; shortdoc: Add support for outline-minor-mode, Daniel Mendler, 2022/02/15
- bug#53981: 28.0.91; shortdoc: Add support for outline-minor-mode, Juri Linkov, 2022/02/16
- bug#53981: 28.0.91; shortdoc: Add support for outline-minor-mode, Lars Ingebrigtsen, 2022/02/17
- bug#53981: 28.0.91; shortdoc: Add support for outline-minor-mode,
Daniel Mendler <=
- bug#53981: 28.0.91; shortdoc: Add support for outline-minor-mode, Lars Ingebrigtsen, 2022/02/17
- bug#53981: 28.0.91; shortdoc: Add support for outline-minor-mode, Juri Linkov, 2022/02/17
- bug#53981: 28.0.91; shortdoc: Add support for outline-minor-mode, Lars Ingebrigtsen, 2022/02/19