From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#71469: font-lock does not apply standard faces and their descendants Date: Mon, 10 Jun 2024 15:55:57 +0300 Message-ID: <86tti17y8y.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26802"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71469@debbugs.gnu.org To: Konstantin Kharlamov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 10 17:13:14 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sGght-0006ke-Rd for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 10 Jun 2024 17:13:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sGghW-0000F0-F5; Mon, 10 Jun 2024 11:12:50 -0400 Original-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 ) id 1sGghU-0000EM-KE for bug-gnu-emacs@gnu.org; Mon, 10 Jun 2024 11:12:48 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sGghU-0007Xb-Aw for bug-gnu-emacs@gnu.org; Mon, 10 Jun 2024 11:12:48 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sGghl-0003et-9L for bug-gnu-emacs@gnu.org; Mon, 10 Jun 2024 11:13:05 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 10 Jun 2024 15:13:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71469 X-GNU-PR-Package: emacs Original-Received: via spool by 71469-submit@debbugs.gnu.org id=B71469.171803233913863 (code B ref 71469); Mon, 10 Jun 2024 15:13:05 +0000 Original-Received: (at 71469) by debbugs.gnu.org; 10 Jun 2024 15:12:19 +0000 Original-Received: from localhost ([127.0.0.1]:40738 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sGgh0-0003bT-An for submit@debbugs.gnu.org; Mon, 10 Jun 2024 11:12:19 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:47768) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sGggu-0003Zs-2j; Mon, 10 Jun 2024 11:12:12 -0400 Original-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 ) 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==; In-Reply-To: (message from Konstantin Kharlamov on Mon, 10 Jun 2024 14:59:37 +0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:287038 Archived-At: tags 71469 notabug thanks > From: Konstantin Kharlamov > 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)