From rwinkler@niu.edu Sat Dec 5 11:15:43 2009 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 From rgm@gnu.org Sat Dec 5 12:32:12 2009 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 Subject: Re: bug#5129: 23.1.50; adding font-lock-keywords for face highlight 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 monnier@iro.umontreal.ca Sat Dec 5 13:04:37 2009 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 From rwinkler@niu.edu Sat Dec 5 15:32:57 2009 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 Subject: Re: bug#5129: 23.1.50; adding font-lock-keywords for face highlight 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 From unknown Sun Aug 17 04:16:35 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 03 Jan 2010 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A long time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator