How can I fix a simple macro fooin (elisp) Eval during extension ?
None of the following work:
(defmacro foo1 (a)
`(setq (eval ,a) t))
(defmacro foo2 (a)
`(setq ,(eval a) t))
(defmacro foo3 (a)
`(setq ,a t))
I really don't understand what (elisp) Eval says during extension . I think if I succeeded, I could fix the macro.
Update: huaiyuan solution works:
(defmacro foo7 (a)
`(set ,a t))
(setq x 'b
a 'c)
(foo7 x)
(assert (eq b t))
(assert (eq x 'b))
(foo7 a)
(assert (eq a 'c))
(assert (eq c t))
(macroexpand '(foo7 x)) ; ==> (set x t)
(macroexpand '(foo7 a)) ; ==> (set a t)
source
share