From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim Johnson Newsgroups: gmane.emacs.help Subject: Re: Evaluating a 'variable' in a nested list Date: Wed, 21 Apr 2010 16:44:48 -0500 Organization: AkWebsoft Message-ID: References: <87bpdcfwew.fsf@sphinx.net.ru> Reply-To: tim@johnsons-web.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1273013774 1939 80.91.229.12 (4 May 2010 22:56:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 4 May 2010 22:56:14 +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:56:13 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 1O9R2D-0007Z5-96 for geh-help-gnu-emacs@m.gmane.org; Wed, 05 May 2010 00:56:13 +0200 Original-Received: from localhost ([127.0.0.1]:51036 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9R2C-00071i-Qw for geh-help-gnu-emacs@m.gmane.org; Tue, 04 May 2010 18:56:12 -0400 Original-Path: usenet.stanford.edu!news.glorb.com!news2.glorb.com!news.glorb.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail Original-NNTP-Posting-Date: Wed, 21 Apr 2010 16:44:48 -0500 Original-Newsgroups: gnu.emacs.help User-Agent: slrn/0.9.9p1 (Linux) Original-Lines: 42 Original-X-Trace: sv3-Q0EJ3sDWyZiQIYQn9s24Zu4aT1c81YPNg19I2cmJzZ+3yeRNQQxpGm4RX+BoYv02XCUf2HN3YBmiT2n!Euy1fx+yDMnL/3vta9uMKymhrjR2UinsUFawFKRz0tDBjaShkrWVEkiY2W3IkIgWdyLgLPc= Original-X-Complaints-To: www.supernews.com/docs/abuse.html X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 Original-Xref: usenet.stanford.edu gnu.emacs.help:177830 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:73262 Archived-At: On 2010-04-21, Dmitry Dzhus wrote: > Tim Johnson wrote: <<..>> 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`: I did find the quasi-quote solution independently, but thank you for the explanation above. That explains things quite well. > (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: And I did arrive at index 0 myself. Your reformatted example below > (add-hook 'scheme-mode-hook > (lambda () > (font-lock-add-keywords > nil > `((,scheme-user-keywords-regexp . ;; Note the dot > scheme-font-lock-user-keywords-face))))) Ah! Thanks very much -- Tim tim@ johnsons-web.com||akwebsoft.com http://www.akwebsoft.com