[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#50034: 28.0.50; elisp capf error "Wrong type argument: listp, elisp-
From: |
Stefan Monnier |
Subject: |
bug#50034: 28.0.50; elisp capf error "Wrong type argument: listp, elisp--witness--lisp" |
Date: |
Tue, 23 Aug 2022 10:17:52 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
> Slightly simpler repro:
>
> (defmacro foo bar
> M-: (elisp--local-variables) RET
>
> It fails here:
>
> (`(lambda ,args . ,body)
> (elisp--local-variables-1
> (append (remq '&optional (remq '&rest args)) vars)
> (car (last body))))
>
> where it expects args to be a list, but it's the symbol
> `elisp--witness--lisp'.
Since the code can be completely non-sensical, `elisp--local-variables`
shouldn't presume that the arglist is indeed a list. I installed the fix
below on `master`.
Stefan
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 0c4a9bfdbea..6d8ced7f220 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -383,7 +383,9 @@ elisp--local-variables-1
(setq sexp nil))
(`(lambda ,args . ,body)
(elisp--local-variables-1
- (append (remq '&optional (remq '&rest args)) vars)
+ (let ((args (if (listp args) args)))
+ ;; FIXME: Exit the loop if witness is in args.
+ (append (remq '&optional (remq '&rest args)) vars))
(car (last body))))
(`(condition-case ,_ ,e) (elisp--local-variables-1 vars e))
(`(condition-case ,v ,_ . ,catches)