[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 1559cc4: Fix missing file&line info in "Unknown defun property" w
From: |
Stefan Monnier |
Subject: |
master 1559cc4: Fix missing file&line info in "Unknown defun property" warnings |
Date: |
Sat, 23 Jan 2021 16:04:46 -0500 (EST) |
branch: master
commit 1559cc445a306b61b2a47c710e049ea26fe5265d
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
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`.
---
lisp/emacs-lisp/byte-run.el | 16 +++++++++++-----
lisp/emacs-lisp/macroexp.el | 14 ++++++++------
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 0f8dd5a..88f362d 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -232,8 +232,11 @@ The return value is undefined.
#'(lambda (x)
(let ((f (cdr (assq (car x) macro-declarations-alist))))
(if f (apply (car f) name arglist (cdr x))
- (message "Warning: Unknown macro property %S in %S"
- (car x) name))))
+ (macroexp--warn-and-return
+ (format-message
+ "Unknown macro property %S in %S"
+ (car x) name)
+ nil))))
decls)))
;; Refresh font-lock if this is a new macro, or it is an
;; existing macro whose 'no-font-lock-keyword declaration
@@ -301,9 +304,12 @@ The return value is undefined.
(cdr body)
body)))
nil)
- (t (message "Warning: Unknown defun property `%S' in %S"
- (car x) name)))))
- decls))
+ (t
+ (macroexp--warn-and-return
+ (format-message "Unknown defun property `%S' in %S"
+ (car x) name)
+ nil)))))
+ decls))
(def (list 'defalias
(list 'quote name)
(list 'function
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index 3784497..aa49bcc 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))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 1559cc4: Fix missing file&line info in "Unknown defun property" warnings,
Stefan Monnier <=