summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2021-02-15 12:07:52 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2021-02-15 12:07:52 -0500
commitd41a4ad4ae6f25c3cbc90aaaa33781821bb655c5 (patch)
treefa6a38297d23961f44925a6a0c3d5cde471ef49f /lisp/emacs-lisp
parent899619ff6a73cc75880327ad74ec29f072328d79 (diff)
downloademacs-d41a4ad4ae6f25c3cbc90aaaa33781821bb655c5.tar.gz
emacs-d41a4ad4ae6f25c3cbc90aaaa33781821bb655c5.tar.bz2
emacs-d41a4ad4ae6f25c3cbc90aaaa33781821bb655c5.zip
* lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Warn on empty let bodies
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/macroexp.el7
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index 13ff5ef2eda..0934e43e66a 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -299,7 +299,12 @@ Assumes the caller has bound `macroexpand-all-environment'."
(`(,(and fun (or 'let 'let*)) . ,(or `(,bindings . ,body) dontcare))
(macroexp--cons fun
(macroexp--cons (macroexp--all-clauses bindings 1)
- (macroexp--all-forms body)
+ (if (null body)
+ (macroexp-unprogn
+ (macroexp--warn-and-return
+ (format "Empty %s body" fun)
+ nil t))
+ (macroexp--all-forms body))
(cdr form))
form))
(`(,(and fun `(lambda . ,_)) . ,args)