emacs-devel
[Top][All Lists]
Advanced

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

Re: font-lock-keywords uses only facename


From: Miles Bader
Subject: Re: font-lock-keywords uses only facename
Date: Sun, 06 Jun 2004 08:03:52 +0900

Richard Stallman <address@hidden> writes:
>     - when "compiling" the keywords, do something like
>
>       (if (and (symbolp expr) (not (boundp expr)) (facep expr))
>           (list 'quote expr)
>         expr)
>
> That sounds like a good idea to me.  It is simple and does the job.

I wonder if the `boundp' check could result in fragile behavior though
-- if someone writes a font-lock expression depending on the above
behavior, and then later a variable gets added that uses the same name,
suddenly the font-lock expression will start trying to use the variable
value, which might be a very confusing bug to find.

Except for the standard `font-lock-...-face' variables, do we have any
idea how widespread the use of variables-pointing-to-face-names in
font-lock expressions is?

If it's extremely rare, I'd be um, less nervous (don't want to say "more
happy" :-), simply making a rule that says "you can't use variable names
there except for the standard ones", i.e., use this code instead:

   (if (and (symbolp expr) (not (memq expr standard-face-variables)))
       (list 'quote expr)
     expr)

It would be kinda ugly, less backward compatible, and less `simple', but
maybe safer and more maintainable in the long run...

-Miles
-- 
P.S.  All information contained in the above letter is false,
      for reasons of military security.





reply via email to

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