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

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

Re: elisp macros problem


From: Barry Margolin
Subject: Re: elisp macros problem
Date: Sat, 24 Jul 2004 15:15:27 -0400
User-agent: MT-NewsWatcher/3.4 (PPC Mac OS X)

In article <address@hidden>,
 Lowell Kirsh <address@hidden> 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.

-- 
Barry Margolin, address@hidden
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


reply via email to

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