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: 24 Jul 2004 22:50:18 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Pascal Bourguignon <address@hidden> writes:

> Barry Margolin <address@hidden> writes:
> 
> > In article <address@hidden>,
> >  Lowell Kirsh <address@hidden> wrote:
> > 
> > > (defmacro my-add-hook (hook &rest body)
> > >    (let ((tempvar (make-symbol "cat")))
> > >      `(flet ((,tempvar (sym str)
> > >                        (make-symbol (concat (symbol-name sym) str))))
> > >         (add-hook (cat ,hook "-mode-hook") (lambda () ,@body)))))
> > > 
> > > Does anyone know what's wrong with this and why it doesn't work?
> > 
> > You need to use ,tempvar in place of cat in the last line.
> 
> Then, (not (eq (make-symbol "toto")(make-symbol "toto"))), even on
> emacs lisp.  You should use intern!

For accessing xxx-mode-hook, yes.  But for the "cat" thingy, ,tempvar
would be ok, even though pretty pointless: one does not really need to
bind a function here.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


reply via email to

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