Subject: bug#74156: 29.4; Incorrect face with outline-minor-mode-highlight in lisp-mode

From: Andreas Matthias <[email-masked]>
Date: Sun, 3 Nov 2024 00:40:46 +0100

On Sat, Nov 2, 2024 at 6:16 PM Juri Linkov <[email-masked]> wrote:
>
> > I guess this is due to the definition of outline-regexp in lisp-mode.el:
> >
> > ";;;;* [^ \t\n]\\|(\\|\\(^;;;###\\(\\([-[:alnum:]]+?\\)-\\)?\\
> > (autoload\\)\\)"

[...]

> Isn't the face 'outline-8' because 'lisp-outline-level' returns
> the level 1000 for the opening parenthesis in 'lisp-outline-level':
>
>   (defun lisp-outline-level ()
>     (let ((len (- (match-end 0) (match-beginning 0))))
>       (cond ((or (looking-at-p "(")
>                  (looking-at-p lisp-mode-autoload-regexp))
>              1000)

AFAIU font-lock is using `outline-regexp` which triggers
`outline-font-lock-face()`
and eventually `lisp-outline-level()`.

My naive approach was to modify `outline-regexp`, i.e. remove the
opening parenthesis
in the regexp. Then `outline-font-lock-face()` cannot be triggered by
this regexp any more
and thus won't override the faces of normal lisp code.

The issue with this approach is: All commands that show, hide, or move to
outline headings use `outline-regexp` as well. Thus these commands won't
find headings starting with an opening parenthesis.

I don't know how important this opening-parenthesis-rule is. Actually I don't
need it. But I guess there were reasons to add it to the regexp.

Andreas