]> git.eshelyaron.com Git - emacs.git/commitdiff
Make previous empty-body warning disabling more robust
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 6 Jul 2021 20:01:55 +0000 (22:01 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 6 Jul 2021 20:01:55 +0000 (22:01 +0200)
* lisp/emacs-lisp/macroexp.el (macroexp--expand-all):
`byte-compile-warning-enabled-p' may not be defined here.

lisp/emacs-lisp/macroexp.el

index 11387df2147f9598a90e110b0d793de55b0c2700..f4bab9c3456ca9c018ab7ee2c24bf5ba54b85c4d 100644 (file)
@@ -318,18 +318,20 @@ Assumes the caller has bound `macroexpand-all-environment'."
       (`(,(or 'function 'quote) . ,_) form)
       (`(,(and fun (or 'let 'let*)) . ,(or `(,bindings . ,body)
                                            pcase--dontcare))
-       (macroexp--cons fun
-                       (macroexp--cons
-                        (macroexp--all-clauses bindings 1)
-                        (if (null body)
-                            (macroexp-unprogn
-                             (macroexp-warn-and-return
-                              (and (byte-compile-warning-enabled-p t)
-                                   (format "Empty %s body" fun))
-                              nil t))
-                          (macroexp--all-forms body))
-                        (cdr form))
-                       form))
+       (macroexp--cons
+        fun
+        (macroexp--cons
+         (macroexp--all-clauses bindings 1)
+         (if (null body)
+             (macroexp-unprogn
+              (macroexp-warn-and-return
+               (and (or (not (fboundp 'byte-compile-warning-enabled-p))
+                        (byte-compile-warning-enabled-p t))
+                    (format "Empty %s body" fun))
+               nil t))
+           (macroexp--all-forms body))
+         (cdr form))
+        form))
       (`(,(and fun `(lambda . ,_)) . ,args)
        ;; Embedded lambda in function position.
        ;; If the byte-optimizer is loaded, try to unfold this,