From: Juri Linkov <juri@linkov.net>
To: uzibalqa <uzibalqa@proton.me>
Cc: 64177@debbugs.gnu.org
Subject: bug#64177: outline-minor-mode-highlight fails to activate for custom headings
Date: Wed, 21 Jun 2023 09:13:30 +0300 [thread overview]
Message-ID: <86o7l9wdp9.fsf@mail.linkov.net> (raw)
In-Reply-To: <KALZj_J_FEYgeRMpIJZpzRYUI0abBcIfnSg7SOQ6YbcCTFLjLt83cs4XfgmVHzuEGUu6MOVUsQBBIE5P0EkINf7PdfI8SLEZocJT1Sfl4Vc=@proton.me> (uzibalqa@proton.me's message of "Tue, 20 Jun 2023 20:06:23 +0000")
>> > (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.
next prev parent reply other threads:[~2023-06-21 6:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-19 20:13 bug#64177: outline-minor-mode-highlight fails to activate for custom headings uzibalqa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-20 6:50 ` Juri Linkov
2023-06-20 10:55 ` uzibalqa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-20 16:50 ` Juri Linkov
2023-06-20 20:06 ` uzibalqa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-21 6:13 ` Juri Linkov [this message]
2023-06-21 10:14 ` uzibalqa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-21 15:58 ` Juri Linkov
2023-06-24 12:21 ` uzibalqa via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-25 17:13 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86o7l9wdp9.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=64177@debbugs.gnu.org \
--cc=uzibalqa@proton.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.