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

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

Re: elisp macros problem


From: Pascal Bourguignon
Subject: Re: elisp macros problem
Date: 24 Jul 2004 21:59:05 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Barry Margolin <barmar@alum.mit.edu> writes:

> In article <cduad9$7tg$1@mughi.cs.ubc.ca>,
>  Lowell Kirsh <lkirsh@cs.ubc.ca> wrote:
> 
> > I am defining an emacs lisp macro to do:
> > 
> > (my-add-hook 'lisp
> >     ...)
> > 
> > which should give:
> > 
> > (add-hook 'lisp-mode-hook
> >    (lambda () ...))
> > 
> > I have:
> > 
> > (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!


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

There is no worse tyranny than to force a man to pay for what he does not
want merely because you think it would be good for him. -- Robert Heinlein


reply via email to

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