bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

font-lock requires face to be `defface'd and `defvar'ed


From: Miguel Frasson
Subject: font-lock requires face to be `defface'd and `defvar'ed
Date: Fri, 26 Dec 2003 00:56:11 +0100 (MET)

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]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]