1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

* 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.
This commit is contained in:
Stefan Monnier 2021-12-01 22:51:39 -05:00
parent 603bdc8d38
commit c6dd8dd223

View file

@ -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)