unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* font-lock requires face to be `defface'd and `defvar'ed
@ 2003-12-25 23:56 Miguel Frasson
  0 siblings, 0 replies; 2+ messages in thread
From: Miguel Frasson @ 2003-12-25 23:56 UTC (permalink / raw)


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]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: font-lock requires face to be `defface'd and `defvar'ed
       [not found] <mailman.630.1072400306.868.bug-gnu-emacs@gnu.org>
@ 2003-12-27  9:26 ` Alexander Pohoyda
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Pohoyda @ 2003-12-27  9:26 UTC (permalink / raw)


Miguel Frasson <frasson@math.leidenuniv.nl> writes:

> ;; 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

Please try this: 
        (("foo". 'foo-face))		;keywords
instead.


>       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))


-- 
Alexander Pohoyda <alexander.pohoyda@gmx.net>
PGP Key fingerprint: 7F C9 CC 5A 75 CD 89 72  15 54 5F 62 20 23 C6 44

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-12-27  9:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-25 23:56 font-lock requires face to be `defface'd and `defvar'ed Miguel Frasson
     [not found] <mailman.630.1072400306.868.bug-gnu-emacs@gnu.org>
2003-12-27  9:26 ` Alexander Pohoyda

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).