Pascal Bourguignon <spam@thalassa.informatimago.com> writes:
Barry Margolin <barmar@alum.mit.edu> writes:
In article <cduad9$7tg$1@mughi.cs.ubc.ca>,
Lowell Kirsh <lkirsh@cs.ubc.ca> 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.