summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2022-01-14 12:26:30 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2022-01-14 12:26:30 -0500
commitd29291d665e808307126bf52c3e748fef78f0f9c (patch)
tree04ce49706d839c83d5cab1c3c2a56dc0fe4db6fa /lisp/emacs-lisp
parentbef9fcc999af5ed5524990c86968be9f9c4497ea (diff)
downloademacs-d29291d665e808307126bf52c3e748fef78f0f9c.tar.gz
emacs-d29291d665e808307126bf52c3e748fef78f0f9c.tar.bz2
emacs-d29291d665e808307126bf52c3e748fef78f0f9c.zip
(macroexp--expand-all): Fix bug#53227 and bug#46636
* lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Don't mis-expand invalid funcalls.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/macroexp.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index b44917f7d56..33ce55a3de8 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -366,14 +366,18 @@ Assumes the caller has bound `macroexpand-all-environment'."
form)
(macroexp--expand-all newform))))
- (`(funcall . ,(or `(,exp . ,args) pcase--dontcare))
+ (`(funcall ,exp . ,args)
(let ((eexp (macroexp--expand-all exp))
(eargs (macroexp--all-forms args)))
;; Rewrite (funcall #'foo bar) to (foo bar), in case `foo'
;; has a compiler-macro, or to unfold it.
(pcase eexp
- (`#',f (macroexp--expand-all `(,f . ,eargs)))
+ ((and `#',f
+ (guard (not (or (special-form-p f) (macrop f)))));; bug#46636
+ (macroexp--expand-all `(,f . ,eargs)))
(_ `(funcall ,eexp . ,eargs)))))
+ (`(funcall . ,_) form) ;bug#53227
+
(`(,func . ,_)
(let ((handler (function-get func 'compiler-macro))
(funargs (function-get func 'funarg-positions)))