From: Stefan Monnier Date: Thu, 2 Dec 2021 03:51:39 +0000 (-0500) Subject: * lisp/emacs-lisp/macroexp.el: Improve last change X-Git-Tag: emacs-29.0.90~3629^2~7 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c6dd8dd22338fddb68a8284a63302c712824f598;p=emacs.git * 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. --- diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index 66c276e7b78..48d9c680cba 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 category) + (byte-compile-warning-enabled-p category)) (byte-compile-warn "%s" msg))))) `(progn (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))) (macroexp-warn-and-return - (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))) new-form))) (defun macroexp--unfold-lambda (form &optional name)