GNU bug report logs - #58641
29.0.50; cc-fonts signals void variable: font-lock-reference-face

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Wed, 19 Oct 2022 18:14:02 UTC

Severity: normal

Found in version 29.0.50

Done: Alan Mackenzie <acm <at> muc.de>

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 58641 in the body.
You can then email your comments to 58641 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-cc-mode <at> gnu.org, bug-gnu-emacs <at> gnu.org:
bug#58641; Package emacs. (Wed, 19 Oct 2022 18:14:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
New bug report received and forwarded. Copy sent to bug-cc-mode <at> gnu.org, bug-gnu-emacs <at> gnu.org. (Wed, 19 Oct 2022 18:14:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; cc-fonts signals void variable: font-lock-reference-face
Date: Wed, 19 Oct 2022 14:13:22 -0400
Package: Emacs
Version: 29.0.50


If I start

    % emacs -Q --eval '(make-face `font-lock-reference-face)' -l cc-fonts

I get the error:

    defconst: Symbol’s value as variable is void: font-lock-reference-face

Something like the patch below seems in order.
Not sure if the FIXME is a confusion of mine or is a real problem.


        Stefan


diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index aa16da70703..d8776d8322a 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -146,11 +146,14 @@ c-constant-face-name
 (defconst c-reference-face-name
   (with-no-warnings
    (if (and (c-face-name-p 'font-lock-reference-face)
+	    (boundp 'font-lock-reference-face)
 	    (eq font-lock-reference-face 'font-lock-reference-face))
        ;; This is considered obsolete in Emacs, but it still maps well
        ;; to this use.  (Another reason to do this is to get unique
        ;; faces for the test suite.)
        'font-lock-reference-face
+     ;; FIXME: `font-lock-reference-face' was an alias for
+     ;; `font-lock-constant-face', not `font-lock-label-face'.
      c-label-face-name)))
 
 ;; This should not mapped to a face that also is used to fontify things
@@ -586,7 +589,8 @@ c-fontify-recorded-types-and-refs
 			(c-lang-const c-opt-cpp-macro-define)
 			(c-lang-const c-nonempty-syntactic-ws)
 			"\\(" (c-lang-const ; 1 + ncle + nsws
-			       c-symbol-key) "\\)"
+			       c-symbol-key)
+			"\\)"
 			(concat "\\("	; 2 + ncle + nsws + c-sym-key
 				;; Macro with arguments - a "function".
 				"\\((\\)" ; 3 + ncle + nsws + c-sym-key





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58641; Package emacs. (Tue, 25 Oct 2022 10:10:02 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: bug-cc-mode <at> gnu.org, 58641 <at> debbugs.gnu.org
Subject: Re: bug#58641: 29.0.50; cc-fonts signals void variable:
 font-lock-reference-face
Date: Tue, 25 Oct 2022 10:09:12 +0000
Hello, Stefan.

	Sorry it's taken me so long to getting around to answering.  The last
few days have been a bit busy.

On Wed, Oct 19, 2022 at 14:13:22 -0400, Stefan Monnier via CC-Mode-help wrote:
> Package: Emacs
> Version: 29.0.50


> If I start

>     % emacs -Q --eval '(make-face `font-lock-reference-face)' -l cc-fonts

> I get the error:

>     defconst: Symbol’s value as variable is void: font-lock-reference-face

> Something like the patch below seems in order.

GRRRR!  Yes, it is in order.  A small point, perhaps, but we aim for
perfection in CC Mode.  ;-)  I'll commit this, after checking that
the same thing doesn't happen anywhere else in cc-fonts.el.  Actually,
it does, so I'll correct those other things, too.

> Not sure if the FIXME is a confusion of mine or is a real problem.

The aliasing of missing faces is a mass of confusion, which takes up
more mental energy than it deserves.  But yes, it would be better for
f-l-reference-face to be mapped to f-l-constant-face before defaulting
to c-label-face-name.  I'll do this, too.

>         Stefan


> diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
> index aa16da70703..d8776d8322a 100644
> --- a/lisp/progmodes/cc-fonts.el
> +++ b/lisp/progmodes/cc-fonts.el
> @@ -146,11 +146,14 @@ c-constant-face-name
>  (defconst c-reference-face-name
>    (with-no-warnings
>     (if (and (c-face-name-p 'font-lock-reference-face)
> +	    (boundp 'font-lock-reference-face)
>  	    (eq font-lock-reference-face 'font-lock-reference-face))
>         ;; This is considered obsolete in Emacs, but it still maps well
>         ;; to this use.  (Another reason to do this is to get unique
>         ;; faces for the test suite.)
>         'font-lock-reference-face
> +     ;; FIXME: `font-lock-reference-face' was an alias for
> +     ;; `font-lock-constant-face', not `font-lock-label-face'.
>       c-label-face-name)))
 
>  ;; This should not mapped to a face that also is used to fontify things
> @@ -586,7 +589,8 @@ c-fontify-recorded-types-and-refs
>  			(c-lang-const c-opt-cpp-macro-define)
>  			(c-lang-const c-nonempty-syntactic-ws)
>  			"\\(" (c-lang-const ; 1 + ncle + nsws
> -			       c-symbol-key) "\\)"
> +			       c-symbol-key)
> +			"\\)"
>  			(concat "\\("	; 2 + ncle + nsws + c-sym-key
>  				;; Macro with arguments - a "function".
>  				"\\((\\)" ; 3 + ncle + nsws + c-sym-key

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58641; Package emacs. (Tue, 25 Oct 2022 12:52:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Alan Mackenzie <acm <at> muc.de>
Cc: bug-cc-mode <at> gnu.org, 58641 <at> debbugs.gnu.org
Subject: Re: bug#58641: 29.0.50; cc-fonts signals void variable:
 font-lock-reference-face
Date: Tue, 25 Oct 2022 08:51:39 -0400
Hi Alan,

>> If I start
>
>>     % emacs -Q --eval '(make-face `font-lock-reference-face)' -l cc-fonts
>
>> I get the error:
>
>>     defconst: Symbol’s value as variable is void: font-lock-reference-face
>
>> Something like the patch below seems in order.
>
> GRRRR!  Yes, it is in order.  A small point, perhaps, but we aim for
> perfection in CC Mode.  ;-)

For the record, I bumped into the above because apparently one of the
many packages I have installed defines `font-lock-reference-face`
(probably some very old code that should be removed as well, but
I haven't tracked it down yet).


        Stefan





Reply sent to Alan Mackenzie <acm <at> muc.de>:
You have taken responsibility. (Tue, 25 Oct 2022 13:44:03 GMT) Full text and rfc822 format available.

Notification sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
bug acknowledged by developer. (Tue, 25 Oct 2022 13:44:03 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: bug-cc-mode <at> gnu.org, 58641-done <at> debbugs.gnu.org
Subject: Re: bug#58641: 29.0.50; cc-fonts signals void variable:
 font-lock-reference-face
Date: Tue, 25 Oct 2022 13:43:21 +0000
Hello, Stefan.

On Tue, Oct 25, 2022 at 08:51:39 -0400, Stefan Monnier wrote:
> Hi Alan,

> >> If I start

> >>     % emacs -Q --eval '(make-face `font-lock-reference-face)' -l cc-fonts

> >> I get the error:

> >>     defconst: Symbol’s value as variable is void: font-lock-reference-face

> >> Something like the patch below seems in order.

> > GRRRR!  Yes, it is in order.  A small point, perhaps, but we aim for
> > perfection in CC Mode.  ;-)

> For the record, I bumped into the above because apparently one of the
> many packages I have installed defines `font-lock-reference-face`
> (probably some very old code that should be removed as well, but
> I haven't tracked it down yet).

Ah, so that was it.

I've just committed a patch, and I'm closing the bug with this post.

I didn't actually comment your comment about font-lock-constant-face, I
amended the code instead.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 23 Nov 2022 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 271 days ago.

Previous Next


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