unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Miles Bader <miles@gnu.org>
Subject: Re: font-lock-keywords uses only facename
Date: Sun, 06 Jun 2004 08:03:52 +0900	[thread overview]
Message-ID: <87oenxbo9z.fsf@tc-1-100.kawasaki.gol.ne.jp> (raw)
In-Reply-To: E1BWbWh-00044p-E8@fencepost.gnu.org

Richard Stallman <rms@gnu.org> 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	other threads:[~2004-06-05 23:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-03 23:48 font-lock-keywords uses only facename Alex Schroeder
2004-06-03 23:55 ` Miles Bader
2004-06-04  3:33   ` Stefan Monnier
2004-06-04  3:41     ` Miles Bader
2004-06-04  3:58       ` Stefan Monnier
2004-06-04  4:08         ` Miles Bader
2004-06-05 15:58           ` Stefan
2004-06-05 13:47     ` Richard Stallman
2004-06-05 23:03       ` Miles Bader [this message]
2004-06-06 22:33         ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87oenxbo9z.fsf@tc-1-100.kawasaki.gol.ne.jp \
    --to=miles@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).