Byte compilation outputs all errors and warnings into the buffer *Compile-Log*. The messages include file names and line numbers that identify the location of the problem. The usual Emacs commands for operating on compiler diagnostics work properly on these messages.
When an error is due to invalid syntax in the program, the byte compiler might get confused about the errors' exact location. One way to investigate is to switch to the buffer *Compiler Input*. (This buffer name starts with a space, so it does not show up in M-x list-buffers.) This buffer contains the program being compiled, and point shows how far the byte compiler was able to read; the cause of the error might be nearby. See Syntax Errors, for some tips for locating syntax errors.
When the byte compiler warns about functions that were used but not defined, it always reports the line number for the end of the file, not the locations where the missing functions were called. To find the latter, you must search for the function names.
You can suppress the compiler warning for calling an undefined
function func by conditionalizing the function call on an
fboundp test, like this:
(if (fboundp 'func) ...(func ...)...)
The call to func must be in the then-form of the
if, and func must appear quoted in the call to
fboundp. (This feature operates for
cond as well.)
You can tell the compiler that a function is defined using
declare-function (see Declaring Functions). Likewise, you
can tell the compiler that a variable is defined using
with no initial value.
You can suppress the compiler warning for a specific use of an
undefined variable variable by conditionalizing its use on a
boundp test, like this:
(if (boundp 'variable) ...variable...)
The reference to variable must be in the then-form of the
if, and variable must appear quoted in the call to
You can suppress any and all compiler warnings within a certain
expression using the construct
In execution, this is equivalent to
...), but the compiler does not issue warnings for anything that occurs inside body.
We recommend that you use this construct around the smallest possible piece of code, to avoid missing possible warnings other than one you intend to suppress.
More precise control of warnings is possible by setting the variable