Problem with macro with-timer
Andrea De Michele
andrea.demichele at gmail.com
Tue Mar 4 14:23:20 UTC 2014
I tried to call the macro with-timer like this:
(with-timer (2) (focus-frame-by (find-frame-by-name "notification")))
But sbcl give me the following error:
The variable #:G1442 is unbound.
If I call the macro with the optional parameter id like this all works:
(with-timer (2 (gensym)) (focus-frame-by (find-frame-by-name "notification")))
I think (but I'm not sure) that the problem is that the default value
for the optional parameter id is evaluated before macroexpansion.
If I change the definition of with-timer from:
(defmacro with-timer ((delay &optional (id (gensym))) &body body)
"Same thing as add-timer but with syntaxic sugar"
`(add-timer ,delay
(lambda ()
, at body)
,id))
to:
(defmacro with-timer ((delay &optional (id '(gensym))) &body body)
"Same thing as add-timer but with syntaxic sugar"
`(add-timer ,delay
(lambda ()
, at body)
,id))
both the way to call the macro (with and without the optional id parameters) works.
--
Andrea De Michele
More information about the clfswm-devel
mailing list