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

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

Re: font-lock-add-keywords confusion


From: Stefan Monnier
Subject: Re: font-lock-add-keywords confusion
Date: Sat, 10 Feb 2007 15:10:56 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.93 (gnu/linux)

> Sorry, nevermind.  I obviously didn't understant the types of the
> arguments.

Yes, the arg is not a face, but an expression whose evaluation returns
a face.  The added expressive power is very important.

> So, in case anyone searches and finds this, the answer is, the face
> name needs to be quoted, as in:

> (font-lock-add-keywords nil
>   '(("foo" 0 'underline)))

> The stock font-lock face names (like font-lock-builtin-face, etc) all
> are symbols that point to themselves (or something like that) and so
> are more-or-less self-quoting.

Yes, pretty much, or more precisely, the font-lock-<foo>-face are all both
faces and variables whose value is the corresponding face.

> Kinda strange, at least for a lisp newbie.

Yes, it's too bad the same name was chosen.  It should have been "variable
font-lock-foo-face has value `font-lock-foo' which is a face".

The purpose of those vars is not just to make it "self-quoting", but rather
to be able to change the face in some buffers, by making the variable local
to that buffer.


        Stefan



reply via email to

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