diff options
author | Glenn Morris <rgm@gnu.org> | 2018-03-12 11:29:01 -0700 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2018-03-12 11:29:01 -0700 |
commit | 8048caab1d4125991b475be0ff8052f319221174 (patch) | |
tree | fcf468687f1979c00d5b28cad90c94c0021ea227 /lisp/emacs-lisp/bytecomp.el | |
parent | 6b80a585c7f3600805c8cced58aa1f196e679c7c (diff) | |
download | emacs-8048caab1d4125991b475be0ff8052f319221174.tar.gz |
Make compiler warn about use of obsolete hooks
* lisp/emacs-lisp/bytecomp.el (byte-compile-form):
Warn about using obsolete hooks.
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 2a986f6cbbc..b3ea9300b01 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -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)) |