GNU bug report logs - #64177
outline-minor-mode-highlight fails to activate for custom headings

Previous Next

Package: emacs;

Reported by: uzibalqa <uzibalqa <at> proton.me>

Date: Mon, 19 Jun 2023 20:14:02 UTC

Severity: normal

Merged with 64227

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 64177 in the body.
You can then email your comments to 64177 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#64177; Package emacs. (Mon, 19 Jun 2023 20:14:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to uzibalqa <uzibalqa <at> proton.me>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 19 Jun 2023 20:14:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: uzibalqa <uzibalqa <at> proton.me>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: outline-minor-mode-highlight fails to activate for custom headings
Date: Mon, 19 Jun 2023 20:13:32 +0000
I have made custom headings for outline-minor-mode 

But

(setq outline-minor-mode-highlight 'override)

does not succeed in displaying the foreground colours at the
defined levels when using

(set-face-foreground "outline-1" "#ff62d4")
(set-face-foreground "outline-2" "#9f80ff")
(set-face-foreground "outline-3" "#fe6060")

Yet, the colours get properly displayed for the default headings
for the specific major mode





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64177; Package emacs. (Tue, 20 Jun 2023 07:02:02 GMT) Full text and rfc822 format available.

Message #8 received at 64177 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: uzibalqa <uzibalqa <at> proton.me>
Cc: 64177 <at> debbugs.gnu.org
Subject: Re: bug#64177: outline-minor-mode-highlight fails to activate for
 custom headings
Date: Tue, 20 Jun 2023 09:50:06 +0300
> I have made custom headings for outline-minor-mode
>
> But
>
> (setq outline-minor-mode-highlight 'override)
>
> does not succeed in displaying the foreground colours at the
> defined levels when using
>
> (set-face-foreground "outline-1" "#ff62d4")
> (set-face-foreground "outline-2" "#9f80ff")
> (set-face-foreground "outline-3" "#fe6060")
>
> Yet, the colours get properly displayed for the default headings
> for the specific major mode

Thanks for the bug report.  It's still not clear how to test it.
When tried to evaluate (set-face-foreground "outline-1" "#ff62d4")
it failed with Lisp error: (wrong-type-argument symbolp "outline-1")
because the right syntax is (set-face-foreground 'outline-1 "#ff62d4").
Does it work with this fix?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64177; Package emacs. (Tue, 20 Jun 2023 10:57:02 GMT) Full text and rfc822 format available.

Message #11 received at 64177 <at> debbugs.gnu.org (full text, mbox):

From: uzibalqa <uzibalqa <at> proton.me>
To: Juri Linkov <juri <at> linkov.net>
Cc: 64177 <at> debbugs.gnu.org
Subject: Re: bug#64177: outline-minor-mode-highlight fails to activate for
 custom headings
Date: Tue, 20 Jun 2023 10:55:44 +0000
------- Original Message -------
On Tuesday, June 20th, 2023 at 6:50 PM, Juri Linkov <juri <at> linkov.net> wrote:


> > I have made custom headings for outline-minor-mode
> > 
> > But
> > 
> > (setq outline-minor-mode-highlight 'override)
> > 
> > does not succeed in displaying the foreground colours at the
> > defined levels when using
> > 
> > (set-face-foreground "outline-1" "#ff62d4")
> > (set-face-foreground "outline-2" "#9f80ff")
> > (set-face-foreground "outline-3" "#fe6060")
> > 
> > Yet, the colours get properly displayed for the default headings
> > for the specific major mode
> 
> 
> Thanks for the bug report. It's still not clear how to test it.
> When tried to evaluate (set-face-foreground "outline-1" "#ff62d4")
> it failed with Lisp error: (wrong-type-argument symbolp "outline-1")
> because the right syntax is (set-face-foreground 'outline-1 "#ff62d4").
> Does it work with this fix?

I have done this and still showing failure upon 'override

(defvar elisp-hglevels
  '( (";;; H1" . 1) (";;; H2" . 2) (";;; H3" . 3) (";;; H4" . 4)
     (";;; H5" . 5) (";;; H6" . 6) (";;; H7" . 7) (";;; H8" . 8) ))

;;-------------

(defun outlhg-regexp ()

  (cond
    ((eq major-mode 'emacs-lisp-mode)
          (let ( (hrklevels elisp-hrklevels) )
            (setq outline-regexp
                  (concat (regexp-opt (mapcar 'car hrklevels)) "\\>"))
            (setq outline-heading-alist hrklevels))) ))

;; ---------

(defun outlhg-tyface ()
  (interactive)

  (let* ( (pigment-darkbg  '("#ff62d4" "#9f80ff" "#fe6060" "#fba849"
                             "#4fe42f" "#4fafff" "#f0dd60" "#FFFFFF"))
          (pigment-lightbg '("#1f1fce" "#006800" "#b60000" "#605b00"
                             "#a8007f" "#005f88" "#904200" "#7f10d0"))
          (pigment
           (if (eq (frame-parameter nil 'background-mode) 'dark)
               pigment-darkbg
             pigment-lightbg)) )

    (dotimes (i 8)
      (let ((hkfc (intern (format "outline-%d" (1+ i))))
            (colr (nth i pigment)))
        (set-face-foreground hkfc colr)))))
 
;;------------- 

(outline-minor-mode 0)
(setq outline-minor-mode-highlight 'override)
(outlhg-regexp)
(outlhg-tyface)
(outline-minor-mode 1)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64177; Package emacs. (Tue, 20 Jun 2023 16:53:02 GMT) Full text and rfc822 format available.

Message #14 received at 64177 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: uzibalqa <uzibalqa <at> proton.me>
Cc: 64177 <at> debbugs.gnu.org
Subject: Re: bug#64177: outline-minor-mode-highlight fails to activate for
 custom headings
Date: Tue, 20 Jun 2023 19:50:27 +0300
> I have done this and still showing failure upon 'override
>
> (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)
> ...
> (outline-minor-mode 0)
> (setq outline-minor-mode-highlight 'override)
> (outlhg-regexp)
> (outlhg-tyface)
> (outline-minor-mode 1)

Please also try:

  (setq-local outline-level 'outline-level)

because 'emacs-lisp-mode' overrides the default value
with own 'lisp-outline-level'.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64177; Package emacs. (Tue, 20 Jun 2023 20:07:01 GMT) Full text and rfc822 format available.

Message #17 received at 64177 <at> debbugs.gnu.org (full text, mbox):

From: uzibalqa <uzibalqa <at> proton.me>
To: Juri Linkov <juri <at> linkov.net>
Cc: 64177 <at> debbugs.gnu.org
Subject: Re: bug#64177: outline-minor-mode-highlight fails to activate for
 custom headings
Date: Tue, 20 Jun 2023 20:06:23 +0000
------- Original Message -------
On Wednesday, June 21st, 2023 at 4:50 AM, Juri Linkov <juri <at> linkov.net> wrote:


> > I have done this and still showing failure upon 'override
> > 
> > (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)
> > ...
> > (outline-minor-mode 0)
> > (setq outline-minor-mode-highlight 'override)
> > (outlhg-regexp)
> > (outlhg-tyface)
> > (outline-minor-mode 1)
> 
> 
> 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.







Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64177; Package emacs. (Wed, 21 Jun 2023 06:23:02 GMT) Full text and rfc822 format available.

Message #20 received at 64177 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: uzibalqa <uzibalqa <at> proton.me>
Cc: 64177 <at> debbugs.gnu.org
Subject: Re: bug#64177: outline-minor-mode-highlight fails to activate for
 custom headings
Date: Wed, 21 Jun 2023 09:13:30 +0300
>> > (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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64177; Package emacs. (Wed, 21 Jun 2023 10:16:02 GMT) Full text and rfc822 format available.

Message #23 received at 64177 <at> debbugs.gnu.org (full text, mbox):

From: uzibalqa <uzibalqa <at> proton.me>
To: Juri Linkov <juri <at> linkov.net>
Cc: 64177 <at> debbugs.gnu.org
Subject: Re: bug#64177: outline-minor-mode-highlight fails to activate for
 custom headings
Date: Wed, 21 Jun 2023 10:14:51 +0000
------- Original Message -------
On Wednesday, June 21st, 2023 at 6:13 PM, Juri Linkov <juri <at> linkov.net> wrote:


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

In the modes that override the default, outline-level could be
set up to use outline-heading-alist, avoiding the conditional.







Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64177; Package emacs. (Wed, 21 Jun 2023 15:59:02 GMT) Full text and rfc822 format available.

Message #26 received at 64177 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: uzibalqa <uzibalqa <at> proton.me>
Cc: 64177 <at> debbugs.gnu.org
Subject: Re: bug#64177: outline-minor-mode-highlight fails to activate for
 custom headings
Date: Wed, 21 Jun 2023 18:58:04 +0300
>> 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.
>
> In the modes that override the default, outline-level could be
> set up to use outline-heading-alist, avoiding the conditional.

Patches are welcome to support outline-heading-alist in the
aforementioned functions.




Forcibly Merged 64177 64227. Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Thu, 22 Jun 2023 18:59:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64177; Package emacs. (Sat, 24 Jun 2023 12:23:02 GMT) Full text and rfc822 format available.

Message #31 received at 64177 <at> debbugs.gnu.org (full text, mbox):

From: uzibalqa <uzibalqa <at> proton.me>
To: Juri Linkov <juri <at> linkov.net>
Cc: 64177 <at> debbugs.gnu.org
Subject: Re: bug#64177: outline-minor-mode-highlight fails to activate for
 custom headings
Date: Sat, 24 Jun 2023 12:21:47 +0000
------- Original Message -------
On Thursday, June 22nd, 2023 at 3:58 AM, Juri Linkov <juri <at> linkov.net> wrote:


> > > 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.
> > 
> > In the modes that override the default, outline-level could be
> > set up to use outline-heading-alist, avoiding the conditional.
> 
> 
> Patches are welcome to support outline-heading-alist in the
> aforementioned functions.

How does emacs-lisp-mode handle outline headings ?  Always setting the
defaults first, then the user can reset the variables outline-regexp, 
outline-heading-alist, and outline-level before enabling outline-minor-mode ?





Reply sent to Juri Linkov <juri <at> linkov.net>:
You have taken responsibility. (Sun, 25 Jun 2023 17:28:02 GMT) Full text and rfc822 format available.

Notification sent to uzibalqa <uzibalqa <at> proton.me>:
bug acknowledged by developer. (Sun, 25 Jun 2023 17:28:02 GMT) Full text and rfc822 format available.

Message #36 received at 64177-done <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: uzibalqa <uzibalqa <at> proton.me>
Cc: 64177-done <at> debbugs.gnu.org
Subject: Re: bug#64177: outline-minor-mode-highlight fails to activate for
 custom headings
Date: Sun, 25 Jun 2023 20:13:31 +0300
> How does emacs-lisp-mode handle outline headings ?  Always setting the
> defaults first, then the user can reset the variables outline-regexp,
> outline-heading-alist, and outline-level before enabling outline-minor-mode ?

Yes, you need to set the variables outline-regexp, outline-heading-alist,
and outline-level before enabling outline-minor-mode.

Since you have a working solution now, I'm closing this request.




Reply sent to Juri Linkov <juri <at> linkov.net>:
You have taken responsibility. (Sun, 25 Jun 2023 17:28:03 GMT) Full text and rfc822 format available.

Notification sent to uzibalqa <uzibalqa <at> proton.me>:
bug acknowledged by developer. (Sun, 25 Jun 2023 17:28:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 24 Jul 2023 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 334 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.