From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Miguel Frasson Newsgroups: gmane.emacs.bugs Subject: font-lock requires face to be `defface'd and `defvar'ed Date: Fri, 26 Dec 2003 00:56:11 +0100 (MET) Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <20031225235611.AE7D3880F@test.math.leidenuniv.nl> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1072396719 20663 80.91.224.253 (25 Dec 2003 23:58:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 25 Dec 2003 23:58:39 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 26 00:58:36 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AZfNE-00006K-00 for ; Fri, 26 Dec 2003 00:58:36 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AZgJ9-0005HU-46 for geb-bug-gnu-emacs@m.gmane.org; Thu, 25 Dec 2003 19:58:27 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AZgJ7-0005G9-4a for bug-gnu-emacs@gnu.org; Thu, 25 Dec 2003 19:58:25 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AZgIZ-0004pX-IF for bug-gnu-emacs@gnu.org; Thu, 25 Dec 2003 19:58:22 -0500 Original-Received: from [132.229.231.22] (helo=mailgate.math.leidenuniv.nl) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AZgIU-0004kD-JL for bug-gnu-emacs@gnu.org; Thu, 25 Dec 2003 19:57:46 -0500 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by mailgate.math.leidenuniv.nl (Postfix) with ESMTP id 1FF52AC40 for ; Fri, 26 Dec 2003 00:56:16 +0100 (MET) Original-Received: from mailgate.math.leidenuniv.nl ([127.0.0.1]) by localhost (mailgate [127.0.0.1:10024]) (amavisd-new) with ESMTP id 21859-09 for ; Fri, 26 Dec 2003 00:56:12 +0100 (MET) Original-Received: from test.math.leidenuniv.nl (brutus.math.leidenuniv.nl [132.229.229.84]) by mailgate.math.leidenuniv.nl (Postfix) with ESMTP id EE8F2AC31 for ; Fri, 26 Dec 2003 00:56:11 +0100 (MET) Original-Received: by test.math.leidenuniv.nl (Postfix, from userid 685) id AE7D3880F; Fri, 26 Dec 2003 00:56:11 +0100 (MET) Original-To: bug-gnu-emacs@gnu.org X-Virus-Scanned: by amavisd-new X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list 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.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:6387 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:6387 This bug report will be sent to the Free Software Foundation, not to your local site managers! Please write in English, because the Emacs maintainers do not have translators to read other languages for them. Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list, and to the gnu.emacs.bug news group. In GNU Emacs 21.2.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2002-08-29 on astest configured using `configure --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --target=i386-redhat-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --with-gcc --with-pop --with-sound' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US locale-coding-system: iso-latin-1 default-enable-multibyte-characters: t Please describe exactly what actions triggered the bug and the precise symptoms of the bug: I was defining faces in a major mode when I discover this (apparent) bug. What happens is that (defface some-face ... ) defines the face but font-lock-mode apparently needs also that the symbol `some-face' to be set (apparently expanding to itself) in order to work. This appears to be known since `C-h v font-lock-string-face RET'describes the *variable* `font-lock-string-face' has as doc string "Face name to use for strings." Possible actions: * fix `deffaces' * fix `font-lock' * fix emacs-lisp manual A simple code to illustrate the bug: ;; this code should be enoght to highlight in green all ;; `foo's... however a terrible thing happens: the symbol foo-face ;; is not set :( (progn ;; defining `foo-face' first just using `defface' (defface foo-face '((t (:foreground "green"))) "foo face") (defconst foo-font-lock-defaults '( (("foo". foo-face)) ;keywords nil nil nil backward-paragraph)) (make-local-variable 'font-lock-defaults) (setq font-lock-defaults foo-font-lock-defaults) (font-lock-mode nil) ; turn font-lock off and on (font-lock-mode t)) ;; now, we set foo-face to expand to itself (like what happens with ;; faces like `font-lock-string-face') and we execute the same `progn' ;; as before... yes!! all `foo's in green! (progn ;; defining `foo-face'sa face and variable now (defface foo-face '((t (:foreground "green"))) "foo face") (defvar foo-face 'foo-face) (defconst foo-font-lock-defaults '( (("foo". foo-face)) ;keywords nil nil nil backward-paragraph)) (make-local-variable 'font-lock-defaults) (setq font-lock-defaults foo-font-lock-defaults) (font-lock-mode nil) ; turn font-lock off and on (font-lock-mode t)) Recent input: ESC [ 2 1 ~ ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B RET ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B RET Recent messages: Loading /public/emacs/lisp/x-symbol/auto-autoloads...done Loading /public/emacs/lisp/x-symbol/custom-load...done Loading /usr/libexec/emacs/21.2/i686-pc-linux-gnu/fns-21.2.1.el (source)...done Loading /home/frasson/.xemacs/init.el (source)...done Loading /home/frasson/.xemacs/custom.el (source)...done For information about the GNU Project and its goals, type C-h C-p. Loading tmm...done Loading view...done Loading emacsbug...done call-interactively: End of buffer [4 times]