bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#64177: outline-minor-mode-highlight fails to activate for custom hea


From: Juri Linkov
Subject: bug#64177: outline-minor-mode-highlight fails to activate for custom headings
Date: Wed, 21 Jun 2023 09:13:30 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

>> > (defvar elisp-hglevels
>> > '( (";;; H1" . 1) (";;; H2" . 2) (";;; H3" . 3) (";;; H4" . 4)
>> > (";;; H5" . 5) (";;; H6" . 6) (";;; H7" . 7) (";;; H8" . 8) ))
>> > ...
>> > ((eq major-mode 'emacs-lisp-mode)
>> > ...
>> >             (setq outline-regexp
>> >                   (concat (regexp-opt (mapcar 'car hrklevels)) "\\>"))
>> >             (setq outline-heading-alist hrklevels))) ))
>> Please also try:
>>
>> (setq-local outline-level 'outline-level)
>>
>> because 'emacs-lisp-mode' overrides the default value
>> with own 'lisp-outline-level'.
>
> Now that I have tried your suggestion, I can the the requested highlighting.
>
> I see that the value of outline-level is lisp-outline-level.  Whereas with 
> your change
> it is outline-level.
>
> In principle, shouldn't outline-level be directly determined by the level 
> specified
> in outline-heading-alist ?  If emacs-lisp-mode sets outline-heading-alist 
> itself
> properly then any level information can be extracted from there.  Then the 
> setup would
> run more smoothly because it would be consistent with the way one would 
> actually
> customise it.

This makes sense.  OTOH, if we will change the logic, it might break existing 
code?

Current situation:

  (defun outline-level ()
    (or (cdr (assoc (match-string 0) outline-heading-alist))
        (- (match-end 0) (match-beginning 0))))

but many modes override this default with own function that ignores
outline-heading-alist:

  lisp-outline-level, c-outline-level, cperl-outline-level, perl-outline-level,
  tcl-outline-level, cfengine2-outline-level, conf-outline-level,
  nroff-outline-level, latex-outline-level

- all these ignore outline-heading-alist.

To support outline-heading-alist unconditionally the current calls

  (funcall outline-level)

in many places should be replaced with

  (or (cdr (assoc (match-string 0) outline-heading-alist))
      (funcall outline-level))

I don't think this is feasible, so probably we need only
to add a warning to the docstring of outline-heading-alist.





reply via email to

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