Subject: bug#71469: closed (Re: bug#71469: font-lock does not apply standard faces and their descendants)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 18 Dec 2024 02:53:03 +0000

Your bug report

#71469: font-lock does not apply standard faces and their descendants

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
71469: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71469
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#71469: font-lock does not apply standard faces and their descendants
From: Stefan Kangas <[email-masked]>
To: Stefan Monnier <[email-masked]>
Cc: Eli Zaretskii <[email-masked]>, [email-masked], Konstantin Kharlamov <[email-masked]>
Date: Tue, 17 Dec 2024 18:51:00 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 31.1

Stefan Monnier <[email-masked]> writes:

>> 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.
>
> FWIW, it's a +1 from me (assuming we then silence the resulting
> warnings, of course).

Thanks.

There have been no objections to the suggested patch, so I have now
installed a version of it on master as commit 3d3c1094604.  The
installed change silences all warnings, and updates the manual and NEWS.

The discussion in this thread focused on the wording of the warning, and
there were several good suggestions.  In the end, I settled on the
following, which I hope strikes a compromise between being brief, exact,
and telling the user in clear terms how to fix the warning:

    use the quoted symbol instead: 'font-lock-foo-face

Getting rid of these variables should help avoid the confusion that the
OP had regarding faces and variables.

With that, I'm closing this bug report.

Subject: font-lock does not apply standard faces and their descendants
From: Konstantin Kharlamov <[email-masked]>
To: [email-masked]
Date: Mon, 10 Jun 2024 14:59:37 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

While trying to add a face to a major mode I found that both standard
faces¹ and inherited ones are ignored completely.

In steps below I create a simple major mode and it uses an inherited
face, but face does not get applied. NOTE: if you replace the inherited
face with, for example, `font-lock-constant-face`, it will get
highlighted. I.e. the problem somehow bound to faces.

# Steps to reproduce

1. Create `test.el` file as follows:

     (defface test-face
       '((t (:inherit bold)))
       "Test face.")

     (define-derived-mode my-mode fundamental-mode "My Mode"
       "A minimal mode that highlights 'hello world' text."
       (font-lock-add-keywords nil '(("hello world" 0 test-face)))
         (font-lock-flush))
     (add-to-list 'auto-mode-alist (cons "test.txt" 'my-mode))
     (provide 'my-mode)

   And `test.txt` as follows:
   
     ==> hello world <==

2. Launch Emacs as `emacs -Q -l test.el test.txt`
3. Put a caret over the word `hello` and evaluate M-x describe-char

## Expected

The description buffer mentions that `face` is `test-face`.

## Actual

There is no `face` property at all.

# Additional information

Versions tested: Emacs built from February master and a stable 29.3

The problem actually doesn't seem to be related to `defface`, because
passing `bold` to the `font-lock-add-keywords` had similarly no effect
for some reason. More likely it's related to the "standard faces".

1: https://www.gnu.org/software/emacs/manual/html_node/emacs/Standard-Faces.html