diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2021-12-01 22:51:39 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2021-12-01 22:51:55 -0500 |
commit | c6dd8dd22338fddb68a8284a63302c712824f598 (patch) | |
tree | 38b5bba1b8c51e846d086344443332850c84b82e /lisp/emacs-lisp/macroexp.el | |
parent | 603bdc8d38ce4325380d29423939e5287e8aac17 (diff) | |
download | emacs-c6dd8dd22338fddb68a8284a63302c712824f598.tar.gz emacs-c6dd8dd22338fddb68a8284a63302c712824f598.tar.bz2 emacs-c6dd8dd22338fddb68a8284a63302c712824f598.zip |
* 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.
Diffstat (limited to 'lisp/emacs-lisp/macroexp.el')
-rw-r--r-- | lisp/emacs-lisp/macroexp.el | 15 |
1 files changed, 8 insertions, 7 deletions
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) |