[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master c6dd8dd: * lisp/emacs-lisp/macroexp.el: Improve last change

From: Stefan Monnier
Subject: master c6dd8dd: * lisp/emacs-lisp/macroexp.el: Improve last change
Date: Wed, 1 Dec 2021 22:52:01 -0500 (EST)

branch: master
commit c6dd8dd22338fddb68a8284a63302c712824f598
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * lisp/emacs-lisp/macroexp.el: Improve last change
    Don't burp when `byte-compile-warning-enabled-p` is not yet defined.
    And use the call that we had already instead of adding a new one.
    (macroexp--warn-wrap): Allow `category`
    to be a list to pass to `byte-compile-warning-enabled-p`.
    (macroexp-macroexpand): Simplify accordingly.
 lisp/emacs-lisp/macroexp.el | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index 66c276e..48d9c68 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -137,7 +137,9 @@ Other uses risk returning non-nil value that point to the 
wrong file."
 (defun macroexp--warn-wrap (msg form category)
   (let ((when-compiled (lambda ()
-                         (when (byte-compile-warning-enabled-p category)
+                         (when (if (listp category)
+                                   (apply #'byte-compile-warning-enabled-p 
+                                 (byte-compile-warning-enabled-p category))
                            (byte-compile-warn "%s" msg)))))
        (macroexp--funcall-if-compiled ',when-compiled)
@@ -216,12 +218,11 @@ is executed without being compiled first."
         (let* ((fun (car form))
                (obsolete (get fun 'byte-obsolete-info)))
-           (and (byte-compile-warning-enabled-p 'obsolete fun)
-                (macroexp--obsolete-warning
-                 fun obsolete
-                 (if (symbolp (symbol-function fun))
-                     "alias" "macro")))
-           new-form 'obsolete))
+           (macroexp--obsolete-warning
+            fun obsolete
+            (if (symbolp (symbol-function fun))
+                "alias" "macro"))
+           new-form (list 'obsolete fun)))
 (defun macroexp--unfold-lambda (form &optional name)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]