]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/bytecomp.el (byte-compile--declare-var): Fix warning
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 21 Jan 2021 01:17:11 +0000 (20:17 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 21 Jan 2021 01:17:11 +0000 (20:17 -0500)
Make sure the "declared after first use" is under the control of
the `lexical` option.

lisp/emacs-lisp/bytecomp.el

index 360da6b6ba6e3060c1fba4771c067a007bd9db63..9429d6a0d5d78a57954ff2ff13017163d65867f7 100644 (file)
@@ -2505,7 +2505,8 @@ list that represents a doc string reference.
   (when (memq sym byte-compile-lexical-variables)
     (setq byte-compile-lexical-variables
           (delq sym byte-compile-lexical-variables))
-    (byte-compile-warn "Variable `%S' declared after its first use" sym))
+    (when (byte-compile-warning-enabled-p 'lexical sym)
+      (byte-compile-warn "Variable `%S' declared after its first use" sym)))
   (push sym byte-compile-bound-variables)
   (push sym byte-compile--seen-defvars))