bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#71469: [PATCH] Re: bug#71469: font-lock does not apply standard face


From: Stefan Monnier
Subject: bug#71469: [PATCH] Re: bug#71469: font-lock does not apply standard faces and their descendants
Date: Mon, 10 Jun 2024 13:26:19 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

>> I'm wondering if it would be okay to mention such nuance in the
>> "standard faces" documentation, such as with the attached patch? I
>> think it would be really helpful, because the nuance of how it works is
>> not obvious at all (it would be much easier if none of the faces such
>> as font-lock-keyword-face, would be defining a variable).

No face defines a variable.

Some faces (mostly font-lock faces) have an associated variable whose
content is "the face name" (which is also the variable's name), but it's
not a result of the face itself.  It's a separate explicit definition of
a variable with the same name as the face.

And I agree that it would be simpler if we didn't have those, but
they've been with us since `font-lock.el` in Emacs-19, so it's not easy
to get rid of them.

>>    Here are the standard faces for specifying text appearance.  You can
>> -apply them to specific text when you want the effects they produce.
>> +apply them to specific text when you want the effects they produce. Note
>> +that these faces do not define variables, so to pass such face to
>> +@code{font-lock-keywords} you have to quote it.

You *always* need to quote the face name.  Otherwise you're not
referring to the face but to a variable of the same name (and ideally
we'd want to get rid of the cases where this happens to work, because
the only upside is to save you from typing a quote character, while the
downside is to encourage confusion).


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]