(byte-compile-warnings): Add new option `make-local'.
(byte-compile-warnings-safe-p): Add `make-local'. (byte-compile-make-variable-buffer-local): Allow byte-compile-warnings to suppress this warning.
This commit is contained in:
parent
04cc80ae25
commit
15ce9dcfa1
1 changed files with 9 additions and 4 deletions
|
@ -101,6 +101,8 @@
|
||||||
;; `cl-warnings' (calls to CL functions)
|
;; `cl-warnings' (calls to CL functions)
|
||||||
;; `interactive-only' (calls to commands that are
|
;; `interactive-only' (calls to commands that are
|
||||||
;; not good to call from Lisp)
|
;; not good to call from Lisp)
|
||||||
|
;; `make-local' (dubious calls to
|
||||||
|
;; `make-variable-buffer-local')
|
||||||
;; byte-compile-compatibility Whether the compiler should
|
;; byte-compile-compatibility Whether the compiler should
|
||||||
;; generate .elc files which can be loaded into
|
;; generate .elc files which can be loaded into
|
||||||
;; generic emacs 18.
|
;; generic emacs 18.
|
||||||
|
@ -356,14 +358,16 @@ Elements of the list may be:
|
||||||
cl-functions calls to runtime functions from the CL package (as
|
cl-functions calls to runtime functions from the CL package (as
|
||||||
distinguished from macros and aliases).
|
distinguished from macros and aliases).
|
||||||
interactive-only
|
interactive-only
|
||||||
commands that normally shouldn't be called from Lisp code."
|
commands that normally shouldn't be called from Lisp code.
|
||||||
|
make-local calls to make-variable-buffer-local that may be incorrect."
|
||||||
:group 'bytecomp
|
:group 'bytecomp
|
||||||
:type `(choice (const :tag "All" t)
|
:type `(choice (const :tag "All" t)
|
||||||
(set :menu-tag "Some"
|
(set :menu-tag "Some"
|
||||||
(const free-vars) (const unresolved)
|
(const free-vars) (const unresolved)
|
||||||
(const callargs) (const redefine)
|
(const callargs) (const redefine)
|
||||||
(const obsolete) (const noruntime)
|
(const obsolete) (const noruntime)
|
||||||
(const cl-functions) (const interactive-only))))
|
(const cl-functions) (const interactive-only)
|
||||||
|
(const make-local))))
|
||||||
(put 'byte-compile-warnings 'safe-local-variable 'byte-compile-warnings-safe-p)
|
(put 'byte-compile-warnings 'safe-local-variable 'byte-compile-warnings-safe-p)
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun byte-compile-warnings-safe-p (x)
|
(defun byte-compile-warnings-safe-p (x)
|
||||||
|
@ -374,7 +378,7 @@ Elements of the list may be:
|
||||||
(when (memq e '(free-vars unresolved
|
(when (memq e '(free-vars unresolved
|
||||||
callargs redefine
|
callargs redefine
|
||||||
obsolete noruntime
|
obsolete noruntime
|
||||||
cl-functions interactive-only))
|
cl-functions interactive-only make-local))
|
||||||
e))
|
e))
|
||||||
x)
|
x)
|
||||||
x))))
|
x))))
|
||||||
|
@ -3888,7 +3892,8 @@ that suppresses all warnings during execution of BODY."
|
||||||
;; Warn about misuses of make-variable-buffer-local.
|
;; Warn about misuses of make-variable-buffer-local.
|
||||||
(byte-defop-compiler-1 make-variable-buffer-local byte-compile-make-variable-buffer-local)
|
(byte-defop-compiler-1 make-variable-buffer-local byte-compile-make-variable-buffer-local)
|
||||||
(defun byte-compile-make-variable-buffer-local (form)
|
(defun byte-compile-make-variable-buffer-local (form)
|
||||||
(if (eq (car-safe (car-safe (cdr-safe form))) 'quote)
|
(if (and (eq (car-safe (car-safe (cdr-safe form))) 'quote)
|
||||||
|
(memq 'make-local byte-compile-warnings))
|
||||||
(byte-compile-warn
|
(byte-compile-warn
|
||||||
"`make-variable-buffer-local' should be called at toplevel"))
|
"`make-variable-buffer-local' should be called at toplevel"))
|
||||||
(byte-compile-normal-call form))
|
(byte-compile-normal-call form))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue