unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 71469@debbugs.gnu.org, Konstantin Kharlamov <Hi-Angel@yandex.ru>
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	[thread overview]
Message-ID: <jwvjziwogv1.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <86plso96a9.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 10 Jun 2024 18:17:02 +0300")

>> 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	other threads:[~2024-06-10 17:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-10 11:59 bug#71469: font-lock does not apply standard faces and their descendants Konstantin Kharlamov
2024-06-10 12:55 ` Eli Zaretskii
2024-06-10 13:41   ` bug#71469: [PATCH] " Konstantin Kharlamov
2024-06-10 15:17     ` Eli Zaretskii
2024-06-10 17:26       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvjziwogv1.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=71469@debbugs.gnu.org \
    --cc=Hi-Angel@yandex.ru \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).