]> git.eshelyaron.com Git - emacs.git/commitdiff
Better lambda quote warning
authorMattias Engdegård <mattiase@acm.org>
Wed, 18 Jan 2023 16:30:15 +0000 (17:30 +0100)
committerMattias Engdegård <mattiase@acm.org>
Wed, 18 Jan 2023 17:50:03 +0000 (18:50 +0100)
* 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`.

lisp/emacs-lisp/macroexp.el

index 069adb3edadcfcad2e9c813c3b059786c460d593..c909ffb6933c2e784cde803fd3f4a6c594f25340 100644 (file)
@@ -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.