branch: elpa/macrostep
commit e9a95f47a9395f776e9029539f6ddd2c6d32c0af
Author: joddie <[email protected]>
Commit: joddie <[email protected]>
Fix `macrostep--macro-form-info`
Use `pcase` on the entire form to exclude `(lambda ...)` from
macro-expansion.
---
macrostep.el | 50 +++++++++++++++++++++++++-------------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/macrostep.el b/macrostep.el
index fa3e5b9..2fa7ed1 100644
--- a/macrostep.el
+++ b/macrostep.el
@@ -581,31 +581,31 @@ nil, the file containing the macro definition will be
loaded
using `load-library' and the macro definition returned as normal.
If INHIBIT-AUTOLOAD is non-nil, no files will be loaded, and the
value of DEFINITION in the result will be nil."
- (if (or (not (consp form))
- (not (symbolp (car form))))
- nil
- (let* ((head (car form))
- (macrolet-definition
- (assoc-default head macrostep-environment 'eq)))
- (if macrolet-definition
- `(macro . ,macrolet-definition)
- (let ((compiler-macro-definition
- (and macrostep-expand-compiler-macros
- (get head 'compiler-macro))))
- (if compiler-macro-definition
- `(compiler-macro . ,compiler-macro-definition)
- (condition-case _
- (let ((fun (indirect-function head)))
- (pcase fun
- (`(macro . ,definition)
- fun)
- (`(autoload ,_ ,_ ,_ macro . ,_)
- (if inhibit-autoload
- `(macro)
- (autoload-do-load fun)
- (macrostep--macro-form-info form nil)))
- (_ nil)))
- (void-function nil))))))))
+ (pcase form
+ (`(lambda . ,_) nil)
+ (`(,(and (pred symbolp) head) . ,_)
+ (let ((macrolet-definition
+ (assoc-default head macrostep-environment 'eq)))
+ (if macrolet-definition
+ `(macro . ,macrolet-definition)
+ (let ((compiler-macro-definition
+ (and macrostep-expand-compiler-macros
+ (get head 'compiler-macro))))
+ (if compiler-macro-definition
+ `(compiler-macro . ,compiler-macro-definition)
+ (condition-case _
+ (let ((fun (indirect-function head)))
+ (pcase fun
+ (`(macro . ,definition)
+ `(macro . ,definition))
+ (`(autoload ,_ ,_ ,_ macro . ,_)
+ (if inhibit-autoload
+ `(macro)
+ (autoload-do-load fun)
+ (macrostep--macro-form-info form nil)))
+ (_ nil)))
+ (void-function nil)))))))
+ (_ nil)))
(defun macrostep-expand-1 (form)
"Return result of macro-expanding the top level of FORM by exactly one step.