summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2023-01-18 17:30:15 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2023-01-18 18:50:03 +0100
commit1b52eaa190663756e79f44c02e7388ee53e756b2 (patch)
tree185bd1b4cb032dc538f1a7a86ff16844ecdf5dd9 /lisp/emacs-lisp
parent281f48f19ecad706a639d57cb937afb0b97eded7 (diff)
downloademacs-1b52eaa190663756e79f44c02e7388ee53e756b2.tar.gz
emacs-1b52eaa190663756e79f44c02e7388ee53e756b2.tar.bz2
emacs-1b52eaa190663756e79f44c02e7388ee53e756b2.zip
Better lambda quote warning
* lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Avoid `...` shown backslash-escaped as a symbol, and render an empty argument list as `()` instead of `nil`.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/macroexp.el13
1 files changed, 7 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index 069adb3edad..c909ffb6933 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -458,12 +458,13 @@ Assumes the caller has bound `macroexpand-all-environment'."
(let ((arg (nth funarg form)))
(when (and (eq 'quote (car-safe arg))
(eq 'lambda (car-safe (cadr arg))))
- (setcar (nthcdr funarg form)
- (macroexp-warn-and-return
- (format "%S quoted with ' rather than with #'"
- (let ((f (cadr arg)))
- (if (symbolp f) f `(lambda ,(nth 1 f) ...))))
- arg nil nil (cadr arg))))))
+ (setcar
+ (nthcdr funarg form)
+ (macroexp-warn-and-return
+ (format
+ "(lambda %s ...) quoted with ' rather than with #'"
+ (or (nth 1 (cadr arg)) "()"))
+ arg nil nil (cadr arg))))))
;; Macro expand compiler macros. This cannot be delayed to
;; byte-optimize-form because the output of the compiler-macro can
;; use macros.