From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Dzhus Newsgroups: gmane.emacs.help Subject: Re: Evaluating a 'variable' in a nested list Date: Wed, 21 Apr 2010 23:16:55 +0400 Organization: albasani.net Message-ID: <87bpdcfwew.fsf@sphinx.net.ru> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1273013627 1483 80.91.229.12 (4 May 2010 22:53:47 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 4 May 2010 22:53:47 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed May 05 00:53:46 2010 connect(): No such file or directory Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O9Qzq-0006WU-4d for geh-help-gnu-emacs@m.gmane.org; Wed, 05 May 2010 00:53:46 +0200 Original-Received: from localhost ([127.0.0.1]:49909 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9Qzp-0003xY-Ke for geh-help-gnu-emacs@m.gmane.org; Tue, 04 May 2010 18:53:45 -0400 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-2.dfn.de!news.dfn.de!feeder.erje.net!news2.arglkargh.de!news.albasani.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 43 Original-X-Trace: news.albasani.net ACgqKm5aYD+1WfDGWyemzlgwZiE2jtYLJpxmkavnifPc+3m7AI1krCP3Qlr+0xqMwWk/X29NPceE6kycnu7s4KfvVne+krxm7/at7naHEPpvCV8z7viI0+PbfvNlzPKB Original-X-Complaints-To: abuse@albasani.net Original-NNTP-Posting-Date: Wed, 21 Apr 2010 19:17:41 +0000 (UTC) X-User-ID: dA+Osa4C9LoI/NOSJUJ6f1qd0axJJRvaYbWpCucoT54= Cancel-Lock: sha1:7G64aXHcbAgg5LW5P6N7ORVjjrM= sha1:hTAWEXrqd/TwML4WdOpqJktthHo= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-NNTP-Posting-Host: r2FIqXpCQ/C3RJ3JIi6ppafXPB1grpBGDoKzOBj0eZE= Original-Xref: usenet.stanford.edu gnu.emacs.help:177828 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:73260 Archived-At: Tim Johnson wrote: > When I load a scheme file, syntax highlight fails and I get the > following error message: > """ > Error during redisplay: (void-function scheme-user-keywords-regexp) > """ > I believe that I have coded the following form: > '((scheme-user-keywords-regexp 1 scheme-font-lock-user-keywords-face t)) > Incorrectly, so that 'scheme-user-keywords-regexp is being treated > as a function when the hook is run. By reading docs for `font-lock-add-keywords` function and `font-lock-keywords`, you may find out that each element of keywords list starts from either regexp or name of function to be called to match string for highlighting. Since you've used the quote syntax, `scheme-user-keywords` is added into the list of font lock rules as a symbol and is then treated as a function name. You may use the quasiquote syntax to evaluate just one element of list you use for `font-lock-add-keywords`: (add-hook 'scheme-mode-hook (lambda () (font-lock-add-keywords nil `((,scheme-user-keywords-regexp 0 scheme-font-lock-user-keywords-face t))))) So *the value* of `scheme-user-keywords-regexp` gets into the list. Note that since your matcher regular expression has no subexpressions, you must use index 0 to highlight the whole matched string; instead, you could've just used this: (add-hook 'scheme-mode-hook (lambda () (font-lock-add-keywords nil `((,scheme-user-keywords-regexp . scheme-font-lock-user-keywords-face))))) -- Happy Hacking. http://sphinx.net.ru む