[Top][All Lists]

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

Re: elisp macros problem

From: Lowell Kirsh
Subject: Re: elisp macros problem
Date: Sun, 25 Jul 2004 18:35:18 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040322

Why does this not work:

(defmacro my-add-hooks (hooks &rest body)
  `(dolist (hook ,hooks)
      (my-add-hook hook ,@body)))



Lowell Kirsh 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?


reply via email to

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