GNU bug report logs - #71469
font-lock does not apply standard faces and their descendants

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Konstantin Kharlamov <Hi-Angel@HIDDEN>; Keywords: notabug; dated Mon, 10 Jun 2024 12:33:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Added tag(s) notabug. Request was from Eli Zaretskii <eliz@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 71469 <at> debbugs.gnu.org:


Received: (at 71469) by debbugs.gnu.org; 10 Jun 2024 15:12:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 10 11:12:19 2024
Received: from localhost ([127.0.0.1]:40738 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sGgh0-0003bT-An
	for submit <at> debbugs.gnu.org; Mon, 10 Jun 2024 11:12:19 -0400
Received: from eggs.gnu.org ([209.51.188.92]:47768)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>)
 id 1sGggu-0003Zs-2j; Mon, 10 Jun 2024 11:12:12 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1sGeZe-0003dT-1D; Mon, 10 Jun 2024 08:56:34 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=2Z35AxSPEDyEihgKYjGyflawIpKwvx96G58hJ8SuaNM=; b=m+9dQGvSDmt/n8ymBWfk
 ComPpIcm3Z84USuWDu6MkZKASoeVmNTyzvLC8y/EWQaemeNHzxat8bYKobWy8IeGaLjMkK4C3+NoP
 zQ87vzuSCFLKDpGbKs2DUTSBw1TW1xv2aBPotRA4JKSgWKGAe2WVKsGgazoQ1tYnlBLGn8S5COu1K
 iGyUEEDwJf5KJUCELq/KH0Zpv/UByTuvcCQMS2DDy5LDxPYVxVMQq1rHap5+6nvuXtufus24O83O5
 kKApBx1DSM2RlT0VwBa318OAw86pXkcgHu53kBh4H01OxQEBX2uXJgcMQ0sqRqW9SPqHxOh1PkDwM
 wwyFbplUq2CZUg==;
Date: Mon, 10 Jun 2024 15:55:57 +0300
Message-Id: <86tti17y8y.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Konstantin Kharlamov <Hi-Angel@HIDDEN>
In-Reply-To: <abcb0453868da407f23e412ad31f39b927186ae7.camel@HIDDEN>
 (message from Konstantin Kharlamov on Mon, 10 Jun 2024 14:59:37 +0300)
Subject: Re: bug#71469: font-lock does not apply standard faces and their
 descendants
References: <abcb0453868da407f23e412ad31f39b927186ae7.camel@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 71469
Cc: 71469 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

tags 71469 notabug
thanks

> From: Konstantin Kharlamov <Hi-Angel@HIDDEN>
> Date: Mon, 10 Jun 2024 14:59:37 +0300
> 
>      (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)))

From the ELisp manual:

   Each element of ‘font-lock-keywords’ should have one of these forms:
   [...]
  ‘(MATCHER . FACESPEC)’
       In this kind of element, FACESPEC is an expression whose value
       specifies the face to use for highlighting.  In the simplest case,
       FACESPEC is a Lisp variable (a symbol) whose value is a face name.
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

IOW, there's a difference between a symbol of a variable whose value
is a face name, and that face name itself.

This works for me:

  (defface test-face
    '((t (:inherit bold)))
    "Test face.")
  (defvar test-face 'test-face
    "Face name to use for My Mode.")

  (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)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71469; Package emacs. Full text available.

Message received at 71469 <at> debbugs.gnu.org:


Received: (at 71469) by debbugs.gnu.org; 10 Jun 2024 13:42:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 10 09:42:47 2024
Received: from localhost ([127.0.0.1]:34219 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sGfIN-0007Og-10
	for submit <at> debbugs.gnu.org; Mon, 10 Jun 2024 09:42:47 -0400
Received: from forward502b.mail.yandex.net ([178.154.239.146]:54346)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <Hi-Angel@HIDDEN>) id 1sGfIJ-0007OP-VH
 for 71469 <at> debbugs.gnu.org; Mon, 10 Jun 2024 09:42:45 -0400
Received: from mail-nwsmtp-smtp-production-main-25.sas.yp-c.yandex.net
 (mail-nwsmtp-smtp-production-main-25.sas.yp-c.yandex.net
 [IPv6:2a02:6b8:c08:c8ad:0:640:7c75:0])
 by forward502b.mail.yandex.net (Yandex) with ESMTPS id A1A6B5E6B4;
 Mon, 10 Jun 2024 16:41:54 +0300 (MSK)
Received: by mail-nwsmtp-smtp-production-main-25.sas.yp-c.yandex.net
 (smtp/Yandex) with ESMTPSA id rfdeUv4XsKo0-q2uk7iXG; 
 Mon, 10 Jun 2024 16:41:54 +0300
X-Yandex-Fwd: 1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail;
 t=1718026914; bh=engnPy2cg+AJAOV/aDxxRq1hlG0PecjrseAcQpgtTjw=;
 h=Date:In-Reply-To:Cc:References:To:From:Subject:Message-ID;
 b=mKQwQegzDFnp1VbqHHp7jG41m8kDnQOD1wMMtaVcl+DLE5eMOw/ejYUzN/ppryVnN
 /39XMY7PfDyO75kNkitaOGfEgfqKUU7Sg/avyLVu8aCikfqdOdmmRDWIBmWDfTHlk6
 3BnHYU9BzXiX/JtJaDpRHODs5IbUjcq714Zqloyk=
Authentication-Results: mail-nwsmtp-smtp-production-main-25.sas.yp-c.yandex.net;
 dkim=pass header.i=@yandex.ru
Message-ID: <519d35a7717587222c5da915a9e02ccaa06e9c5b.camel@HIDDEN>
Subject: [PATCH] Re: bug#71469: font-lock does not apply standard faces and
 their descendants
From: Konstantin Kharlamov <Hi-Angel@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Date: Mon, 10 Jun 2024 16:41:53 +0300
In-Reply-To: <86tti17y8y.fsf@HIDDEN>
References: <abcb0453868da407f23e412ad31f39b927186ae7.camel@HIDDEN>
 <86tti17y8y.fsf@HIDDEN>
Content-Type: multipart/mixed; boundary="=-gr4aJWjLqF4eAUxSSPDR"
User-Agent: Evolution 3.52.2 
MIME-Version: 1.0
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71469
Cc: 71469 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-gr4aJWjLqF4eAUxSSPDR
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, 2024-06-10 at 15:55 +0300, Eli Zaretskii wrote:
> tags 71469 notabug
> thanks
>=20
> > From: Konstantin Kharlamov <Hi-Angel@HIDDEN>
> > Date: Mon, 10 Jun 2024 14:59:37 +0300
> >=20
> > =C2=A0=C2=A0=C2=A0=C2=A0 (defface test-face
> > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 '((t (:inherit bold)))
> > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "Test face.")
> >=20
> > =C2=A0=C2=A0=C2=A0=C2=A0 (define-derived-mode my-mode fundamental-mode =
"My Mode"
> > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "A minimal mode that highlights 'h=
ello world' text."
> > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (font-lock-add-keywords nil '(("he=
llo world" 0 test-face)))
>=20
> From the ELisp manual:
>=20
> =C2=A0=C2=A0 Each element of =E2=80=98font-lock-keywords=E2=80=99 should =
have one of these
> forms:
> =C2=A0=C2=A0 [...]
> =C2=A0 =E2=80=98(MATCHER . FACESPEC)=E2=80=99
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 In this kind of element, FACESPEC is=
 an expression whose value
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 specifies the face to use for highli=
ghting.=C2=A0 In the simplest
> case,
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 FACESPEC is a Lisp variable (a symbo=
l) whose value is a face
> name.
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>=20
> IOW, there's a difference between a symbol of a variable whose value
> is a face name, and that face name itself.
>=20
> This works for me:
>=20
> =C2=A0 (defface test-face
> =C2=A0=C2=A0=C2=A0 '((t (:inherit bold)))
> =C2=A0=C2=A0=C2=A0 "Test face.")
> =C2=A0 (defvar test-face 'test-face
> =C2=A0=C2=A0=C2=A0 "Face name to use for My Mode.")
>=20
> =C2=A0 (define-derived-mode my-mode fundamental-mode "My Mode"
> =C2=A0=C2=A0=C2=A0 "A minimal mode that highlights 'hello world' text."
> =C2=A0=C2=A0=C2=A0 (font-lock-add-keywords nil '(("hello world" 0 test-fa=
ce)))
> =C2=A0=C2=A0=C2=A0 (font-lock-flush))
> =C2=A0 (add-to-list 'auto-mode-alist (cons "test.txt" 'my-mode))
> =C2=A0 (provide 'my-mode)

Ooh, I see, thank you! So using e.g. a `'test-face` also makes it work.

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). I've spent
for about an hour on this trying in different ways to make it work, and
I also think it wasn't the first time I stumbled upon this. Having the
"standard faces" mention that interaction nuance I think could be
helpful for people in the future.

--=-gr4aJWjLqF4eAUxSSPDR
Content-Disposition: attachment; filename="1.patch"
Content-Type: text/x-patch; name="1.patch"; charset="UTF-8"
Content-Transfer-Encoding: base64

RnJvbSAwMjgxMWI2NDAwMjU5YzBkOWIyZGVkY2NhNzZmZWM3NzFkY2Q4MzlhIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBLb25zdGFudGluIEtoYXJsYW1vdiA8SGktQW5nZWxAeWFuZGV4
LnJ1PgpEYXRlOiBNb24sIDEwIEp1biAyMDI0IDE2OjM0OjMwICswMzAwClN1YmplY3Q6IFtQQVRD
SF0gTWVudGlvbiBpbnRlcmFjdGlvbiBvZiBzdGFuZGFyZCBmYWNlcyB3aXRoIGZvbnQtbG9jay1r
ZXl3b3JkcwoKKiBkb2MvZW1hY3MvZGlzcGxheS50ZXhpIChzdGFuZGFyZCBmYWNlcyk6IG1lbnRp
b24gdGhhdCB0aGVzZSBmYWNlcyBkbwpub3QgcHJvZHVjZSB2YXJpYWJsZXMgYW5kIHNvIGNhbid0
IGJlIHBhc3NlZCB0byBmb250LWxvY2sta2V5d29yZHMgYXMKaXMuCi0tLQogZG9jL2VtYWNzL2Rp
c3BsYXkudGV4aSB8IDQgKysrLQogMSBmaWxlIGNoYW5nZWQsIDMgaW5zZXJ0aW9ucygrKSwgMSBk
ZWxldGlvbigtKQoKZGlmZiAtLWdpdCBhL2RvYy9lbWFjcy9kaXNwbGF5LnRleGkgYi9kb2MvZW1h
Y3MvZGlzcGxheS50ZXhpCmluZGV4IDhmMjJlM2M4OGRhLi5iY2JlNjhkMjFlYSAxMDA2NDQKLS0t
IGEvZG9jL2VtYWNzL2Rpc3BsYXkudGV4aQorKysgYi9kb2MvZW1hY3MvZGlzcGxheS50ZXhpCkBA
IC02NDcsNyArNjQ3LDkgQEAgU3RhbmRhcmQgRmFjZXMKIEBjaW5kZXggc3RhbmRhcmQgZmFjZXMK
IAogICBIZXJlIGFyZSB0aGUgc3RhbmRhcmQgZmFjZXMgZm9yIHNwZWNpZnlpbmcgdGV4dCBhcHBl
YXJhbmNlLiAgWW91IGNhbgotYXBwbHkgdGhlbSB0byBzcGVjaWZpYyB0ZXh0IHdoZW4geW91IHdh
bnQgdGhlIGVmZmVjdHMgdGhleSBwcm9kdWNlLgorYXBwbHkgdGhlbSB0byBzcGVjaWZpYyB0ZXh0
IHdoZW4geW91IHdhbnQgdGhlIGVmZmVjdHMgdGhleSBwcm9kdWNlLiBOb3RlCit0aGF0IHRoZXNl
IGZhY2VzIGRvIG5vdCBkZWZpbmUgdmFyaWFibGVzLCBzbyB0byBwYXNzIHN1Y2ggZmFjZSB0bwor
QGNvZGV7Zm9udC1sb2NrLWtleXdvcmRzfSB5b3UgaGF2ZSB0byBxdW90ZSBpdC4KIAogQHRhYmxl
IEBjb2RlCiBAaXRlbSBkZWZhdWx0Ci0tIAoyLjQ1LjIKCg==


--=-gr4aJWjLqF4eAUxSSPDR--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71469; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Jun 2024 12:32:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 10 08:32:33 2024
Received: from localhost ([127.0.0.1]:59291 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sGeCP-00046N-Gj
	for submit <at> debbugs.gnu.org; Mon, 10 Jun 2024 08:32:33 -0400
Received: from lists.gnu.org ([209.51.188.17]:41086)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <Hi-Angel@HIDDEN>) id 1sGeCM-00045G-Dy
 for submit <at> debbugs.gnu.org; Mon, 10 Jun 2024 08:32:32 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Hi-Angel@HIDDEN>)
 id 1sGdgl-0007IS-1u
 for bug-gnu-emacs@HIDDEN; Mon, 10 Jun 2024 07:59:52 -0400
Received: from forward103c.mail.yandex.net ([2a02:6b8:c03:500:1:45:d181:d103])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Hi-Angel@HIDDEN>)
 id 1sGdgf-0000WY-KG
 for bug-gnu-emacs@HIDDEN; Mon, 10 Jun 2024 07:59:49 -0400
Received: from mail-nwsmtp-smtp-production-main-17.iva.yp-c.yandex.net
 (mail-nwsmtp-smtp-production-main-17.iva.yp-c.yandex.net
 [IPv6:2a02:6b8:c0c:201a:0:640:4af0:0])
 by forward103c.mail.yandex.net (Yandex) with ESMTPS id 2829860B1D
 for <bug-gnu-emacs@HIDDEN>; Mon, 10 Jun 2024 14:59:38 +0300 (MSK)
Received: by mail-nwsmtp-smtp-production-main-17.iva.yp-c.yandex.net
 (smtp/Yandex) with ESMTPSA id bxbmcD1oBuQ0-ct126Mn6; 
 Mon, 10 Jun 2024 14:59:37 +0300
X-Yandex-Fwd: 1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail;
 t=1718020777; bh=uPyP9UVIP6AZX662pn+J7F+ceYALt1XaaKnqi3XKPJM=;
 h=Date:To:From:Subject:Message-ID;
 b=KpShXcB6zL4hCeTaQP71BklvhGoMIMUI4pOoRTM+MUNnn1/Ym1w3kKRZ1shJX90rP
 AxIZ4aDJiEb20A97M7x0Yo8G9JvKhWAZfMkkU2Sl8izwpkVbitWzZKPyc+X104fcB4
 ndxplyAyxlaFPGxRikdeiQcCyXYRhvdwK7zytNe4=
Authentication-Results: mail-nwsmtp-smtp-production-main-17.iva.yp-c.yandex.net;
 dkim=pass header.i=@yandex.ru
Message-ID: <abcb0453868da407f23e412ad31f39b927186ae7.camel@HIDDEN>
Subject: font-lock does not apply standard faces and their descendants
From: Konstantin Kharlamov <Hi-Angel@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Date: Mon, 10 Jun 2024 14:59:37 +0300
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
User-Agent: Evolution 3.52.2 
MIME-Version: 1.0
Received-SPF: pass client-ip=2a02:6b8:c03:500:1:45:d181:d103;
 envelope-from=Hi-Angel@HIDDEN; helo=forward103c.mail.yandex.net
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

While trying to add a face to a major mode I found that both standard
faces=C2=B9 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:
  =20
     =3D=3D> hello world <=3D=3D

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




Acknowledgement sent to Konstantin Kharlamov <Hi-Angel@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#71469; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 10 Jun 2024 15:15:02 UTC

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