all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org, Alex Schroeder <alex@emacswiki.org>
Subject: Re: font-lock-keywords uses only facename
Date: 03 Jun 2004 23:33:38 -0400	[thread overview]
Message-ID: <m1oeo00zzl.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20040603235508.GA26475@fencepost>

> It's just historical stupidity.

Well, I wouldn't put it qute like this.  Given the fact that any expression
is allowed, and that quoting can be used to get the "unevaluated" behavior,
the current behavior has the advantage of being general and simple.

> If it were being designed today, it would probably just use face names
> directly,

If I were writing it today, I'd just do an `eval' as did Simon Marshall:
it's simpler and there is no loss of generality.  And adding a quote is
really not that difficult.

> but font-lock is _really_ old...

Indeed.  A complete overhaul is long overdue.

> I presume you're asking whether it could do something like:

>    (if (and (symbolp expr) (not (boundp expr)))
>        expr	   ; use face name directly
>      (eval expr))  ; evaluate EXPR to get face name

> ?

> It seems like it would work, though I wonder if it could cause more
> confusion...

I think if we really care about it (although it hasn't bothered us that
much for the last however many years, so I doubt it's worth the trouble),
we could do something like:

- when "compiling" the keywords, do something like

    (if (and (symbolp expr) (not (boundp expr)) (facep expr))
        (list 'quote expr)
      expr)

- put a condition-case around font-lock-fontify-keywords-region like

    (condition-case unbound-err
        ...blabla...
      (void-variable
        (let ((var (cadr unbound-err)))
          (if (and (symbolp var) (not (boundp var)) (facep var))
              (error "Face %s needs to be quoted in font-lock-keywords" var)
            (signal (car unbound-err) (cdr unbound-err))))))


-- Stefan

  reply	other threads:[~2004-06-04  3:33 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 [this message]
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
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

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

  git send-email \
    --in-reply-to=m1oeo00zzl.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=alex@emacswiki.org \
    --cc=emacs-devel@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.