unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefankangas@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Eli Zaretskii <eliz@gnu.org>,
	71469@debbugs.gnu.org, Konstantin Kharlamov <Hi-Angel@yandex.ru>
Subject: bug#71469: font-lock does not apply standard faces and their descendants
Date: Fri, 4 Oct 2024 18:39:06 -0700	[thread overview]
Message-ID: <CADwFkmmjgvc9XtG4Zx5OEY80nji_W41AxcXdDW22dGzBD9ehYQ@mail.gmail.com> (raw)
In-Reply-To: <jwvjziwogv1.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 10 Jun 2024 13:26:19 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

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

We have occasionally declared things obsolete with the understanding
that they'll be deleted much later than the normal "10 years, give or
take".  See the comment in `interactive-p', for example.

The patch below gives me 64 warnings in our tree.  I'm not sure if it's
worth installing or not.

diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 7b077a826bf..7787af43bc9 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -316,46 +316,74 @@ font-lock-verbose
 ;; need to create variables that specify face names.  Simply using
 ;; faces directly is enough.  Font-lock is not a template to be
 ;; followed in this area.
+(make-obsolete-variable 'font-lock-comment-face
+                        "use 'font-lock-comment-face instead." "31.1")
 (defvar font-lock-comment-face		'font-lock-comment-face
   "Face name to use for comments.")

+(make-obsolete-variable 'font-lock-comment-delimiter-face
+                        "use 'font-lock-comment-delimiter-face
instead." "31.1")
 (defvar font-lock-comment-delimiter-face 'font-lock-comment-delimiter-face
   "Face name to use for comment delimiters.")

+(make-obsolete-variable 'font-lock-string-face
+                        "use 'font-lock-string-face instead." "31.1")
 (defvar font-lock-string-face		'font-lock-string-face
   "Face name to use for strings.")

+(make-obsolete-variable 'font-lock-doc-face
+                        "use 'font-lock-doc-face instead." "31.1")
 (defvar font-lock-doc-face		'font-lock-doc-face
   "Face name to use for documentation.")

+(make-obsolete-variable 'font-lock-doc-markup-face
+                        "use 'font-lock-doc-markup-face instead." "31.1")
 (defvar font-lock-doc-markup-face       'font-lock-doc-markup-face
   "Face name to use for documentation mark-up.")

+(make-obsolete-variable 'font-lock-keyword-face
+                        "use 'font-lock-keyword-face instead." "31.1")
 (defvar font-lock-keyword-face		'font-lock-keyword-face
   "Face name to use for keywords.")

+(make-obsolete-variable 'font-lock-builtin-face
+                        "use 'font-lock-builtin-face instead." "31.1")
 (defvar font-lock-builtin-face		'font-lock-builtin-face
   "Face name to use for builtins.")

+(make-obsolete-variable 'font-lock-function-name-face
+                        "use 'font-lock-function-name-face instead." "31.1")
 (defvar font-lock-function-name-face	'font-lock-function-name-face
   "Face name to use for function names.")

+(make-obsolete-variable 'font-lock-variable-name-face
+                        "use 'font-lock-variable-name-face instead." "31.1")
 (defvar font-lock-variable-name-face	'font-lock-variable-name-face
   "Face name to use for variable names.")

+(make-obsolete-variable 'font-lock-type-face
+                        "use 'font-lock-type-face instead." "31.1")
 (defvar font-lock-type-face		'font-lock-type-face
   "Face name to use for type and class names.")

+(make-obsolete-variable 'font-lock-constant-face
+                        "use 'font-lock-constant-face instead." "31.1")
 (defvar font-lock-constant-face		'font-lock-constant-face
   "Face name to use for constant and label names.")

+(make-obsolete-variable 'font-lock-warning-face
+                        "use 'font-lock-warning-face instead." "31.1")
 (defvar font-lock-warning-face		'font-lock-warning-face
   "Face name to use for things that should stand out.")

+(make-obsolete-variable 'font-lock-negation-char-face
+                        "use 'font-lock-negation-char-face instead." "31.1")
 (defvar font-lock-negation-char-face	'font-lock-negation-char-face
   "Face name to use for easy to overlook negation.
 This can be an \"!\" or the \"n\" in \"ifndef\".")

+(make-obsolete-variable 'font-lock-preprocessor-face
+                        "use 'font-lock-preprocessor-face instead." "31.1")
 (defvar font-lock-preprocessor-face	'font-lock-preprocessor-face
   "Face name to use for preprocessor directives.")





  reply	other threads:[~2024-10-05  1:39 UTC|newest]

Thread overview: 15+ 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
2024-10-05  1:39         ` Stefan Kangas [this message]
2024-10-05 13:06           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-08 12:57             ` Robert Pluim
2024-10-08 13:25               ` Konstantin Kharlamov
2024-10-09  8:43                 ` Robert Pluim
2024-10-09  8:58                   ` Konstantin Kharlamov
2024-10-09 12:48                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-09 13:20                     ` Robert Pluim
2024-10-09 14:04                     ` Konstantin Kharlamov
2024-10-09 14:27                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=CADwFkmmjgvc9XtG4Zx5OEY80nji_W41AxcXdDW22dGzBD9ehYQ@mail.gmail.com \
    --to=stefankangas@gmail.com \
    --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).