In Emacs, it is common to get warnings when byte compiling an elisp file. To suppress these warnings, add the following snippit of code to your Emacs configuration file. Thanks Aankhen for the correction.
;; ignore byte-compile warnings
(setq byte-compile-warnings '(not nresolved
free-vars
callargs
redefine
obsolete
noruntime
cl-functions
interactive-only
))
2 comments:
You have two typos in there (‘nresolved’ and ‘noruntine’). Aside from that, you might want to check the documentation for the variable:
,----[ C-h v byte-compile-warnings RET ]
| 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 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 from the CL package (as
| distinguished from macros and aliases).
| interactive-only
| commands that normally shouldn't be called from Lisp code.
| 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.
|
| You can customize this variable.
|
| [back]
`----
In other words, this is a list of warnings that should be issued. You ignore a warning by not listing it here. So one way to ignore all the warnings named in your snippet would be:
,----
| ; uses `set-difference' from the CL package, just because
| (setq byte-compile-warnings (set-difference byte-compile-warning-types
| '(free-vars
| unresolved
| callargs
| redefine
| obsolete
| noruntime
| cl-functions
| interactive-only)))
`----
An alternative method would be to set the value of ‘byte-compile-warnings’ to the list of warnings you want to ignore, preceded by ‘not’.
(It seems neither ‘pre’ nor ‘code’ is allowed in these comments, so the formatting is broken.)
Thanks for the correction. Entry updated.
Post a Comment