From unknown Mon Aug 18 19:23:05 2025 X-Loop: owner@emacsbugs.donarmstrong.com Subject: bug#5129: 23.1.50; adding font-lock-keywords for face highlight Reply-To: "Roland Winkler" , 5129@debbugs.gnu.org Resent-From: "Roland Winkler" Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Sat, 05 Dec 2009 19:20:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-Emacs-PR-Message: report 5129 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by submit@emacsbugs.donarmstrong.com id=B.126004054318506 (code B ref -1); Sat, 05 Dec 2009 19:20:04 +0000 Received: (at submit) by emacsbugs.donarmstrong.com; 5 Dec 2009 19:15:43 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-0.5 required=4.0 tests=AWL,FOURLA autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB5JFfMp018502 for ; Sat, 5 Dec 2009 11:15:43 -0800 Received: from mx10.gnu.org ([199.232.76.166]:40656) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1NH06W-0003Qh-W9 for emacs-pretest-bug@gnu.org; Sat, 05 Dec 2009 14:15:41 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NH06T-0000H5-N7 for emacs-pretest-bug@gnu.org; Sat, 05 Dec 2009 14:15:40 -0500 Received: from tfkpsv.physik.uni-erlangen.de ([131.188.164.197]:10132) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NH06T-0000Gn-8I for emacs-pretest-bug@gnu.org; Sat, 05 Dec 2009 14:15:37 -0500 Received: from regnitz.physics.niu.edu (adsl-68-77-29-3.dsl.emhril.ameritech.net [68.77.29.3]) by tfkpsv.physik.uni-erlangen.de (Postfix) with ESMTP id E71A723532 for ; Sat, 5 Dec 2009 20:15:34 +0100 (CET) Date: Sat, 05 Dec 2009 13:15:31 -0600 Message-Id: <878wdhp6zw.fsf@regnitz.physics.niu.edu> From: "Roland Winkler" To: emacs-pretest-bug@gnu.org X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 The highlight face is somehow treated special in an odd way: If I eval the following in a buffer it will highlight all occurences of "foo" as expected: (font-lock-add-keywords nil '(("foo" . font-lock-constant-face))) Yet when I do instead (font-lock-add-keywords nil '(("foo" . highlight))) it gives me the message (in the *Messages* buffer) Invalid face reference: 0 When I put point at the position of the string "foo" and evaluate (get-text-property (point) 'face) this gives me (0 highlight) which probably explains the "invalid face reference" error. Why is the face `0' added? In GNU Emacs 23.1.50.1 (i686-pc-linux-gnu, GTK+ Version 2.14.4) of 2009-12-04 on regnitz Windowing system distributor `The X.Org Foundation', version 11.0.10502000 Important settings: value of $LC_ALL: nil value of $LC_COLLATE: C value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: en_GB.utf8 value of $LANG: en_US.ISO-8859-15 value of $XMODIFIERS: nil locale-coding-system: iso-latin-9-unix default enable-multibyte-characters: t From unknown Mon Aug 18 19:23:05 2025 X-Loop: owner@emacsbugs.donarmstrong.com Subject: bug#5129: 23.1.50; adding font-lock-keywords for face highlight Reply-To: Glenn Morris , 5129@debbugs.gnu.org Resent-From: Glenn Morris Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Sat, 05 Dec 2009 20:35:07 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-Emacs-PR-Message: followup 5129 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by 5129-submit@emacsbugs.donarmstrong.com id=B5129.126004513227565 (code B ref 5129); Sat, 05 Dec 2009 20:35:07 +0000 Received: (at 5129) by emacsbugs.donarmstrong.com; 5 Dec 2009 20:32:12 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-7.1 required=4.0 tests=AWL,HAS_BUG_NUMBER, X_DEBBUGS_NO_ACK autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB5KWARG027562 for <5129@emacsbugs.donarmstrong.com>; Sat, 5 Dec 2009 12:32:12 -0800 Received: from rgm by fencepost.gnu.org with local (Exim 4.67) (envelope-from ) id 1NH1IV-0000Y6-Ra; Sat, 05 Dec 2009 15:32:07 -0500 From: Glenn Morris To: Roland Winkler Cc: 5129@debbugs.gnu.org References: <878wdhp6zw.fsf@regnitz.physics.niu.edu> X-Spook: digicash threat wire transfer Mahmoud Ahmadinejad FSF X-Ran: 51:v$-y]-5BZohIip#r (Roland Winkler's message of "Sat, 05 Dec 2009 13:15:31 -0600") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii "Roland Winkler" wrote: > (font-lock-add-keywords nil '(("foo" . font-lock-constant-face))) works > (font-lock-add-keywords nil '(("foo" . highlight))) doesn't work. I think you are running into the old issue that faces should be quoted in font-lock keywords, else they will be treated as variables. For historical reasons, font-lock-constant-face (etc) as well as being a face, is a variable whose value is that face. Instead, try (font-lock-add-keywords nil '(("foo" . 'highlight))) From unknown Mon Aug 18 19:23:05 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: owner@emacsbugs.donarmstrong.com From: help-debbugs@gnu.org (Emacs bug Tracking System) To: "Roland Winkler" Subject: bug#5129 closed by Stefan Monnier (Re: bug#5129: 23.1.50; adding font-lock-keywords for face highlight) Message-ID: References: <878wdhp6zw.fsf@regnitz.physics.niu.edu> X-Emacs-PR-Message: they-closed 5129 X-Emacs-PR-Package: emacs Reply-To: 5129@debbugs.gnu.org Date: Sat, 05 Dec 2009 21:10:10 +0000 Content-Type: multipart/mixed; boundary="----------=_1260047410-32397-1" This is a multi-part message in MIME format... ------------=_1260047410-32397-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This is an automatic notification regarding your bug report which was filed against the emacs package: #5129: 23.1.50; adding font-lock-keywords for face highlight It has been closed by Stefan Monnier . Their explanation is attached below along with your original report. If this explanation is unsatisfactory and you have not received a better one in a separate message then please contact Stefan Monnier by replying to this email. --=20 5129: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D5129 Emacs Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1260047410-32397-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 5129-done) by emacsbugs.donarmstrong.com; 5 Dec 2009 21:04:37 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.8 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from ironport2-out.pppoe.ca (ironport2-out.teksavvy.com [206.248.154.183]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB5L4Zp5030863 for <5129-done@emacsbugs.donarmstrong.com>; Sat, 5 Dec 2009 13:04:37 -0800 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Au4EAJRZGktFpZ7i/2dsb2JhbACBS9MBhDMEih4 X-IronPort-AV: E=Sophos;i="4.47,347,1257138000"; d="scan'208";a="50758993" Received: from 69-165-158-226.dsl.teksavvy.com (HELO pastel.home) ([69.165.158.226]) by ironport2-out.pppoe.ca with ESMTP; 05 Dec 2009 16:04:30 -0500 Received: by pastel.home (Postfix, from userid 20848) id 0FBBD80B1; Sat, 5 Dec 2009 16:04:29 -0500 (EST) From: Stefan Monnier To: Roland Winkler Subject: Re: bug#5129: 23.1.50; adding font-lock-keywords for face highlight Message-ID: References: <878wdhp6zw.fsf@regnitz.physics.niu.edu> Date: Sat, 05 Dec 2009 16:04:29 -0500 In-Reply-To: <878wdhp6zw.fsf@regnitz.physics.niu.edu> (Roland Winkler's message of "Sat, 05 Dec 2009 13:15:31 -0600") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > (font-lock-add-keywords nil '(("foo" . font-lock-constant-face))) ^^^^^^^^^^^^^^^^^^^^^^^ > Yet when I do instead > (font-lock-add-keywords nil '(("foo" . highlight))) ^^^^^^^^^ Thos two things are treated by font-lock as a Lisp expression to evaluate. Since font-lock-constant-face is a variable (whose content is usually the symbol font-lock-constant-face), the first will work, whereas the second will either signal en error (because the variable `highlight' doesn't exist) or lead to odd behavior (because `highlight' just happens to be let-bound by one of the caller). I.e. you want (font-lock-add-keywords nil '(("foo" . 'highlight))) ^^^ -- Stefan ------------=_1260047410-32397-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by emacsbugs.donarmstrong.com; 5 Dec 2009 19:15:43 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-0.5 required=4.0 tests=AWL,FOURLA autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB5JFfMp018502 for ; Sat, 5 Dec 2009 11:15:43 -0800 Received: from mx10.gnu.org ([199.232.76.166]:40656) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1NH06W-0003Qh-W9 for emacs-pretest-bug@gnu.org; Sat, 05 Dec 2009 14:15:41 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NH06T-0000H5-N7 for emacs-pretest-bug@gnu.org; Sat, 05 Dec 2009 14:15:40 -0500 Received: from tfkpsv.physik.uni-erlangen.de ([131.188.164.197]:10132) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NH06T-0000Gn-8I for emacs-pretest-bug@gnu.org; Sat, 05 Dec 2009 14:15:37 -0500 Received: from regnitz.physics.niu.edu (adsl-68-77-29-3.dsl.emhril.ameritech.net [68.77.29.3]) by tfkpsv.physik.uni-erlangen.de (Postfix) with ESMTP id E71A723532 for ; Sat, 5 Dec 2009 20:15:34 +0100 (CET) Date: Sat, 05 Dec 2009 13:15:31 -0600 Message-Id: <878wdhp6zw.fsf@regnitz.physics.niu.edu> From: "Roland Winkler" To: emacs-pretest-bug@gnu.org Subject: 23.1.50; adding font-lock-keywords for face highlight X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 The highlight face is somehow treated special in an odd way: If I eval the following in a buffer it will highlight all occurences of "foo" as expected: (font-lock-add-keywords nil '(("foo" . font-lock-constant-face))) Yet when I do instead (font-lock-add-keywords nil '(("foo" . highlight))) it gives me the message (in the *Messages* buffer) Invalid face reference: 0 When I put point at the position of the string "foo" and evaluate (get-text-property (point) 'face) this gives me (0 highlight) which probably explains the "invalid face reference" error. Why is the face `0' added? In GNU Emacs 23.1.50.1 (i686-pc-linux-gnu, GTK+ Version 2.14.4) of 2009-12-04 on regnitz Windowing system distributor `The X.Org Foundation', version 11.0.10502000 Important settings: value of $LC_ALL: nil value of $LC_COLLATE: C value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: en_GB.utf8 value of $LANG: en_US.ISO-8859-15 value of $XMODIFIERS: nil locale-coding-system: iso-latin-9-unix default enable-multibyte-characters: t ------------=_1260047410-32397-1-- From unknown Mon Aug 18 19:23:05 2025 X-Loop: owner@emacsbugs.donarmstrong.com Subject: bug#5129: 23.1.50; adding font-lock-keywords for face highlight Reply-To: "Roland Winkler" , 5129@debbugs.gnu.org Resent-From: "Roland Winkler" Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Sat, 05 Dec 2009 23:40:07 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-Emacs-PR-Message: followup 5129 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by 5129-submit@emacsbugs.donarmstrong.com id=B5129.126005597816465 (code B ref 5129); Sat, 05 Dec 2009 23:40:07 +0000 Received: (at 5129) by emacsbugs.donarmstrong.com; 5 Dec 2009 23:32:58 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-1.9 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from tfkpsv.physik.uni-erlangen.de (tfkpsv.physik.uni-erlangen.de [131.188.164.197]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB5NWuAx016458 for <5129@emacsbugs.donarmstrong.com>; Sat, 5 Dec 2009 15:32:57 -0800 Received: from regnitz.physics.niu.edu (adsl-68-77-29-3.dsl.emhril.ameritech.net [68.77.29.3]) by tfkpsv.physik.uni-erlangen.de (Postfix) with ESMTP id 799042145A; Sun, 6 Dec 2009 00:32:53 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <19226.60828.276540.24161@regnitz.physics.niu.edu> Date: Sat, 5 Dec 2009 17:32:44 -0600 From: "Roland Winkler" To: Glenn Morris Cc: 5129@debbugs.gnu.org, Stefan Monnier In-Reply-To: References: <878wdhp6zw.fsf@regnitz.physics.niu.edu> X-Mailer: VM 8.2 trial under 23.1.50.1 (i686-pc-linux-gnu) On Sat Dec 5 2009 Glenn Morris wrote: > Instead, try > > (font-lock-add-keywords nil '(("foo" . 'highlight))) Oh well, I thought I ran into this often enough. But still it's too easy to forget it again. Thanks for helping me out and sorry for the noise! Roland