For the benefit of clueless readers arriving here, allow me a small digression to say that these warnings generally point to real code issues (and when they don't, you can suppress them on a per-variable basis) so people should research what they mean before disabling them.
Of course, I have no doubt that you know why you need to disable it, so the answer is below.
The answer
In order to disable this (or other) warning, you'll need to set the value of byte-compile-warnings
. You can do this as a file-local variable by adding the following snippet to the end of the file.
;; Local Variables:
;; byte-compile-warnings: (not free-vars)
;; End:
You can also set this globally.
You can replace (not free-vars)
with (not free-vars callargs unresolved)
and whichever other warnings you want to suppress. The full list of warnings that can be included/supressed is found on the variable's docstring (below).
byte-compile-warnings is a variable defined in `bytecomp.el'.
Its value is t
This variable is safe as a file local variable if its value
satisfies the predicate which is a byte-compiled expression.
Documentation:
List of warnings that the byte-compiler should issue (t for all).
Elements of the list may be:
free-vars references to variables not in the current lexical scope.
unresolved calls to unknown functions.
callargs function calls with args that don't match the definition.
redefine function name redefined from a macro to ordinary function or vice
versa, or redefined to take a different number of arguments.
obsolete obsolete variables and functions.
noruntime functions that may not be defined at runtime (typically
defined only under `eval-when-compile').
cl-functions calls to runtime functions (as distinguished from macros and
aliases) from the old CL package (not the newer cl-lib).
interactive-only
commands that normally shouldn't be called from Lisp code.
lexical global/dynamic variables lacking a prefix.
make-local calls to make-variable-buffer-local that may be incorrect.
mapcar mapcar called for effect.
constants let-binding of, or assignment to, constants/nonvariables.
suspicious constructs that usually don't do what the coder wanted.
If the list begins with `not', then the remaining elements specify warnings to
suppress. For example, (not mapcar) will suppress warnings about mapcar.