]> git.eshelyaron.com Git - emacs.git/commitdiff
Make compiler warn about use of obsolete hooks
authorGlenn Morris <rgm@gnu.org>
Mon, 12 Mar 2018 18:29:01 +0000 (11:29 -0700)
committerGlenn Morris <rgm@gnu.org>
Mon, 12 Mar 2018 18:29:01 +0000 (11:29 -0700)
* lisp/emacs-lisp/bytecomp.el (byte-compile-form):
Warn about using obsolete hooks.

lisp/emacs-lisp/bytecomp.el

index 2a986f6cbbc9dea1a0406927cb8aacfb0a18d87c..b3ea9300b01f31ded7a850e54995b3aa31717de6 100644 (file)
@@ -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))