summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/macroexp.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2021-01-23 16:04:36 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2021-01-23 16:04:36 -0500
commit1559cc445a306b61b2a47c710e049ea26fe5265d (patch)
tree5791f5bb8af6d4c353c1b135a79ef849caefc01d /lisp/emacs-lisp/macroexp.el
parentb7068be5c410c5592856aeebd7aa4d62b1dc68e5 (diff)
downloademacs-1559cc445a306b61b2a47c710e049ea26fe5265d.tar.gz
emacs-1559cc445a306b61b2a47c710e049ea26fe5265d.tar.bz2
emacs-1559cc445a306b61b2a47c710e049ea26fe5265d.zip
Fix missing file&line info in "Unknown defun property" warnings
* lisp/emacs-lisp/byte-run.el (defmacro, defun): Use `macroexp--warn-and-return` rather than `message`. * lisp/emacs-lisp/macroexp.el: Fix `macroexp--compiling-p`. (macroexp--warn-and-return): Don't try and detect repetition on forms like `nil`. (macroexp-macroexpand): Don't forget to bind `macroexpand-all-environment`.
Diffstat (limited to 'lisp/emacs-lisp/macroexp.el')
-rw-r--r--lisp/emacs-lisp/macroexp.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index 37844977f8f..aa49bccc8d0 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -127,7 +127,7 @@ and also to avoid outputting the warning during normal execution."
(cond
((null msg) form)
((macroexp--compiling-p)
- (if (gethash form macroexp--warned)
+ (if (and (consp form) (gethash form macroexp--warned))
;; Already wrapped this exp with a warning: avoid inf-looping
;; where we keep adding the same warning onto `form' because
;; macroexpand-all gets right back to macroexpanding `form'.
@@ -138,9 +138,10 @@ and also to avoid outputting the warning during normal execution."
,form)))
(t
(unless compile-only
- (message "%s%s" (if (stringp load-file-name)
- (concat (file-relative-name load-file-name) ": ")
- "")
+ (message "%sWarning: %s"
+ (if (stringp load-file-name)
+ (concat (file-relative-name load-file-name) ": ")
+ "")
msg))
form))))
@@ -180,8 +181,9 @@ and also to avoid outputting the warning during normal execution."
(defun macroexp-macroexpand (form env)
"Like `macroexpand' but checking obsolescence."
- (let ((new-form
- (macroexpand form env)))
+ (let* ((macroexpand-all-environment env)
+ (new-form
+ (macroexpand form env)))
(if (and (not (eq form new-form)) ;It was a macro call.
(car-safe form)
(symbolp (car form))