From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: font-lock-keywords uses only facename Date: 03 Jun 2004 23:33:38 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <87oeo0i4p1.fsf@emacswiki.org> <20040603235508.GA26475@fencepost> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1086320040 27809 80.91.224.253 (4 Jun 2004 03:34:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 4 Jun 2004 03:34:00 +0000 (UTC) Cc: emacs-devel@gnu.org, Alex Schroeder Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Jun 04 05:33:53 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BW5Sr-0003xZ-00 for ; Fri, 04 Jun 2004 05:33:53 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BW5Sr-0005SH-00 for ; Fri, 04 Jun 2004 05:33:53 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BW5TD-0007h5-VQ for emacs-devel@quimby.gnus.org; Thu, 03 Jun 2004 23:34:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BW5T7-0007gz-D7 for emacs-devel@gnu.org; Thu, 03 Jun 2004 23:34:09 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BW5T6-0007gn-LF for emacs-devel@gnu.org; Thu, 03 Jun 2004 23:34:09 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BW5T6-0007gk-Iy for emacs-devel@gnu.org; Thu, 03 Jun 2004 23:34:08 -0400 Original-Received: from [206.47.199.163] (helo=simmts5-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BW5Sd-0000eI-HI; Thu, 03 Jun 2004 23:33:39 -0400 Original-Received: from empanada.local ([67.70.165.15]) by simmts5-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20040604033336.VYCN3387.simmts5-srv.bellnexxia.net@empanada.local>; Thu, 3 Jun 2004 23:33:36 -0400 Original-Received: by empanada.local (Postfix, from userid 502) id B60D9226837; Thu, 3 Jun 2004 23:33:38 -0400 (EDT) Original-To: Miles Bader In-Reply-To: <20040603235508.GA26475@fencepost> Original-Lines: 50 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:24507 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:24507 > 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