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

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

Re: elisp macros problem


From: David Kastrup
Subject: Re: elisp macros problem
Date: 26 Jul 2004 07:55:21 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Lowell Kirsh <lkirsh@cs.ubc.ca> writes:

> Why does this not work:
> 
> (defmacro my-add-hooks (hooks &rest body)
>    `(dolist (hook ,hooks)
>        (my-add-hook hook ,@body)))
> 
> ??

Because you need to write
`(dolist (hook ',hooks)

and then call this with an _unquoted_ list, like
(my-add-hooks (lisp emacs-lisp)
  body)

Apart from that, I consider this sort of thing a crock.  What are you
hoping to achieve that you would not be better off doing by a proper
function instead of a macro?

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


reply via email to

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