How do I avoid byte-compiler warnings Unused lexical variable
in functions defined using macros expanding to defun
?
E.g., macro defun-rcirc-command
in
rcirc.el
uses the target
variable which is not used by several invocations.
In Common Lisp I can use the
ignorable
declaration: (declare (ignorable target))
.
Bad solutions:
Add something like
(setq target target)
to all the users ofdefun-rcirc-command
which do not usetarget
: that requires modifying many macro invocations.Prefixing the ignorable variable with an underscore -
_target
- does not help because_
meansignore
, notignorable
, i.e., when it is used, I getvariable '_target' not left unused
.
(ignore VAR)
for every defun argument before the ,@body expansion which will probably silence the errors.