all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#74156: 29.4; Incorrect face with outline-minor-mode-highlight in lisp-mode
@ 2024-11-01 13:11 Andreas Matthias
  2024-11-02 17:14 ` Juri Linkov
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Matthias @ 2024-11-01 13:11 UTC (permalink / raw)
  To: 74156

[-- Attachment #1: Type: text/plain, Size: 955 bytes --]

Take this example Elisp file:


;;; xxx -- OK: face is outline-1
;;;; xxx -- OK: face is outline-2
(defun test ()) ; WRONG: face is outline-8

;; Local Variables:
;; outline-minor-mode-highlight: override
;; eval: (outline-minor-mode 1)
;; End:


After loading this file into Emacs you will see that the function definition
is displayed incorrectly in face outline-8.

I guess this is due to the definition of outline-regexp in lisp-mode.el:

";;;;* [^
\t\n]\\|(\\|\\(^;;;###\\(\\([-[:alnum:]]+?\\)-\\)?\\(autoload\\)\\)"

Notice the opening parenthesis in the regular expression that causes
the function definition to be recognized as an outline heading.

I removed the opening parenthesis and now the face of the function
definition
is correct. This is fine for me. But note that you loose the ability to move
to top-level expressions, like this function definition, with
(outline-next-visible-heading) and (outline-previous-visible-heading).


Andreas

[-- Attachment #2: Type: text/html, Size: 1164 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#74156: 29.4; Incorrect face with outline-minor-mode-highlight in lisp-mode
  2024-11-01 13:11 bug#74156: 29.4; Incorrect face with outline-minor-mode-highlight in lisp-mode Andreas Matthias
@ 2024-11-02 17:14 ` Juri Linkov
  2024-11-02 23:40   ` Andreas Matthias
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2024-11-02 17:14 UTC (permalink / raw)
  To: Andreas Matthias; +Cc: 74156

> Take this example Elisp file:
>
> ;;; xxx -- OK: face is outline-1
> ;;;; xxx -- OK: face is outline-2
> (defun test ()) ; WRONG: face is outline-8
>
> ;; Local Variables:
> ;; outline-minor-mode-highlight: override
> ;; eval: (outline-minor-mode 1)
> ;; End:
>
> After loading this file into Emacs you will see that the function
> definition
> is displayed incorrectly in face outline-8.
>
> I guess this is due to the definition of outline-regexp in lisp-mode.el:
>
> ";;;;* [^ \t\n]\\|(\\|\\(^;;;###\\(\\([-[:alnum:]]+?\\)-\\)?\\
> (autoload\\)\\)"
>
> Notice the opening parenthesis in the regular expression that causes
> the function definition to be recognized as an outline heading.
>
> I removed the opening parenthesis and now the face of the function
> definition
> is correct. This is fine for me. But note that you loose the ability to
> move
> to top-level expressions, like this function definition, with
> (outline-next-visible-heading) and (outline-previous-visible-heading).

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)

The level 1000 corresponds to outline-8:

Level    1 - outline-1
Level    2 - outline-2
Level    3 - outline-3
Level    4 - outline-4
Level    5 - outline-5
Level    6 - outline-6
Level    7 - outline-7
Level    8 - outline-8
Level    9 - outline-1
Level   10 - outline-2
Level   11 - outline-3
...
Level  998 - outline-6
Level  999 - outline-7
Level 1000 - outline-8





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#74156: 29.4; Incorrect face with outline-minor-mode-highlight in lisp-mode
  2024-11-02 17:14 ` Juri Linkov
@ 2024-11-02 23:40   ` Andreas Matthias
  2024-11-03 17:54     ` Juri Linkov
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Matthias @ 2024-11-02 23:40 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 74156

On Sat, Nov 2, 2024 at 6:16 PM Juri Linkov <juri@linkov.net> 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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#74156: 29.4; Incorrect face with outline-minor-mode-highlight in lisp-mode
  2024-11-02 23:40   ` Andreas Matthias
@ 2024-11-03 17:54     ` Juri Linkov
  2024-11-03 18:25       ` Andreas Matthias
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2024-11-03 17:54 UTC (permalink / raw)
  To: Andreas Matthias; +Cc: 74156

> 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.

So there is no bug here and this report could be closed?

If you don't need opening-parenthesis-rule, it's fine
to customize 'outline-regexp' and 'outline-level'.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#74156: 29.4; Incorrect face with outline-minor-mode-highlight in lisp-mode
  2024-11-03 17:54     ` Juri Linkov
@ 2024-11-03 18:25       ` Andreas Matthias
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Matthias @ 2024-11-03 18:25 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 74156

[-- Attachment #1: Type: text/plain, Size: 777 bytes --]

On Sun, Nov 3, 2024 at 6:58 PM Juri Linkov <juri@linkov.net> wrote:

> > 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.
>
> So there is no bug here and this report could be closed?
>
> If you don't need opening-parenthesis-rule, it's fine
> to customize 'outline-regexp' and 'outline-level'.
>

Please take a look at the example I have given in my very first post.
There you see that font-lock is handling top-level lisp code incorrectly.
This is definitely a bug.

I don't agree with  you that customizing a variable is the recommended
way to fix a bug. But if there's really no other way to handle it, then it
should be documented at least.

Andreas

[-- Attachment #2: Type: text/html, Size: 1982 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-11-03 18:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-01 13:11 bug#74156: 29.4; Incorrect face with outline-minor-mode-highlight in lisp-mode Andreas Matthias
2024-11-02 17:14 ` Juri Linkov
2024-11-02 23:40   ` Andreas Matthias
2024-11-03 17:54     ` Juri Linkov
2024-11-03 18:25       ` Andreas Matthias

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.