mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-24 14:30:43 -08:00
Make compiler warn about use of obsolete hooks
* lisp/emacs-lisp/bytecomp.el (byte-compile-form): Warn about using obsolete hooks.
This commit is contained in:
parent
6b80a585c7
commit
8048caab1d
1 changed files with 5 additions and 0 deletions
|
|
@ -3119,6 +3119,11 @@ for symbols generated by the byte compiler itself."
|
|||
(when (assq var byte-compile-lexical-variables)
|
||||
(byte-compile-report-error
|
||||
(format-message "%s cannot use lexical var `%s'" fn var))))))
|
||||
;; Warn about using obsolete hooks.
|
||||
(if (memq fn '(add-hook remove-hook))
|
||||
(let ((hook (car-safe (cdr form))))
|
||||
(if (eq (car-safe hook) 'quote)
|
||||
(byte-compile-check-variable (cadr hook) nil))))
|
||||
(when (and (byte-compile-warning-enabled-p 'suspicious)
|
||||
(macroexp--const-symbol-p fn))
|
||||
(byte-compile-warn "`%s' called as a function" fn))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue