help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Macro used for dynamic setting of font-lock-keywords


From: Sebastian Tennant
Subject: Re: Macro used for dynamic setting of font-lock-keywords
Date: Sat, 26 May 2007 23:07:41 +0300
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.95 (gnu/linux)

Quoth Tim X <timx@nospam.dev.null>:
> symbol word is getting added to the list. Try this
>
> (defun my-add-keyword (word) 
>     (font-lock-add-keywords nil (cons word font-lock-warning-face)) t))


Your function (above) needs an extra cons but now it works:

  (defun my-add-keyword (word) 
      (font-lock-add-keywords nil (cons (cons word font-lock-warning-face) 
'(t))))

Thanks for pointing out the obvious, although I enjoyed cobbling
together my macro kludge.  I can't believe it didn't occur to me to
use cons.  I suppose it's because I'm thinking macros generally at the
moment, and hell... why use a simple cons or two, when you can write a
complicated macro!

Sebastian





reply via email to

[Prev in Thread] Current Thread [Next in Thread]