GNU bug report logs -
#50034
28.0.50; elisp capf error "Wrong type argument: listp, elisp--witness--lisp"
Previous Next
Reported by: Daniel Mendler <mail <at> daniel-mendler.de>
Date: Fri, 13 Aug 2021 01:27:01 UTC
Severity: normal
Found in version 28.0.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50034 in the body.
You can then email your comments to 50034 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50034
; Package
emacs
.
(Fri, 13 Aug 2021 01:27:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Daniel Mendler <mail <at> daniel-mendler.de>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 13 Aug 2021 01:27:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Steps to reproduce:
1. Start "emacs -Q"
2. Enter "(defmacro foo bar" in the scratch buffer
3. Press M-<tab> to invoke 'completion-at-point'
The capf will throw the error "Wrong type argument: listp,
elisp--witness--lisp". This error will be shown on Emacs 27 and Emacs 28.
The input is nonsensical. I hit this while experimenting with my Corfu
completion UI package. A capf should never error in case no completion
is possible, such that another completion function of lower priority
registered in 'completion-at-point-functions' can take over.
Stack trace:
Debugger entered--Lisp error: (wrong-type-argument listp
elisp--witness--lisp)
remq(&rest elisp--witness--lisp)
elisp--local-variables-1(nil (lambda elisp--witness--lisp nil))
#f(compiled-function (vars sexp) #<bytecode -0x8b1fe1acbf9337e>)(nil
(#'(lambda elisp--witness--lisp nil)))
elisp--local-variables-1(nil #'(lambda elisp--witness--lisp nil))
#f(compiled-function (vars sexp) #<bytecode -0x8b1fe1acbf9337e>)(nil
((cons 'macro #'(lambda elisp--witness--lisp nil))))
elisp--local-variables-1(nil (cons 'macro #'(lambda
elisp--witness--lisp nil)))
#f(compiled-function (vars sexp) #<bytecode -0x8b1fe1acbf9337e>)(nil
((defalias 'foo (cons 'macro #'(lambda elisp--witness--lisp nil)))))
elisp--local-variables-1(nil (defalias 'foo (cons 'macro #'(lambda
elisp--witness--lisp nil))))
elisp--local-variables()
#f(compiled-function (string) #<bytecode 0x11ce5f9950685161>)(#("bar"
0 3 (fontified t)))
#f(compiled-function (string pred action) #<bytecode
0x1441a5b45360593c>)(#("bar" 0 3 (fontified t)) nil nil)
try-completion(#("bar" 0 3 (fontified t)) #f(compiled-function (string
pred action) #<bytecode 0x1441a5b45360593c>) nil)
#f(compiled-function (table) #<bytecode
0x16347446532ce382>)(#f(compiled-function (string pred action)
#<bytecode 0x1441a5b45360593c>))
mapcar(#f(compiled-function (table) #<bytecode 0x16347446532ce382>)
(#f(compiled-function (string pred action) #<bytecode
0x1441a5b45360593c>) #f(compiled-function (&rest args2) #<bytecode
-0xb6f918caeb61f7c>)))
#f(compiled-function (string pred action) #<bytecode
0x129f647999b6137>)(#("bar" 0 3 (fontified t)) nil nil)
try-completion(#("bar" 0 3 (fontified t)) #f(compiled-function (string
pred action) #<bytecode 0x129f647999b6137>) nil)
completion-basic-try-completion(#("bar" 0 3 (fontified t))
#f(compiled-function (string pred action) #<bytecode 0x129f647999b6137>)
nil 3)
#f(compiled-function (style) #<bytecode -0x1fb7ebf98eadbd47>)(basic)
completion--some(#f(compiled-function (style) #<bytecode
-0x1fb7ebf98eadbd47>) (basic partial-completion emacs22))
completion--nth-completion(1 #("bar" 0 3 (fontified t))
#f(compiled-function (string pred action) #<bytecode 0x129f647999b6137>)
nil 3 (metadata))
completion-try-completion(#("bar" 0 3 (fontified t))
#f(compiled-function (string pred action) #<bytecode 0x129f647999b6137>)
nil 3 (metadata))
completion--do-completion(#<marker at 160 in *scratch*> 163)
completion--in-region-1(#<marker at 160 in *scratch*> 163)
#f(compiled-function (start end collection predicate) #<bytecode
-0xf6d24f3ba2b80f7>)(#<marker at 160 in *scratch*> 163
#f(compiled-function (string pred action) #<bytecode 0x129f647999b6137>)
nil)
apply(#f(compiled-function (start end collection predicate) #<bytecode
-0xf6d24f3ba2b80f7>) (#<marker at 160 in *scratch*> 163
#f(compiled-function (string pred action) #<bytecode 0x129f647999b6137>)
nil))
#f(compiled-function (funs global args) #<bytecode
-0xbd1d687a6b6022>)(nil nil (#<marker at 160 in *scratch*> 163
#f(compiled-function (string pred action) #<bytecode 0x129f647999b6137>)
nil))
completion--in-region(#<marker at 160 in *scratch*> 163
#f(compiled-function (string pred action) #<bytecode 0x129f647999b6137>)
nil)
completion-in-region(#<marker at 160 in *scratch*> 163
#f(compiled-function (string pred action) #<bytecode 0x129f647999b6137>)
nil)
completion-at-point()
In GNU Emacs 28.0.50 (build 54, x86_64-pc-linux-gnu, GTK+ Version
3.24.5, cairo version 1.16.0)
of 2021-08-12 built on projects
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50034
; Package
emacs
.
(Fri, 13 Aug 2021 12:14:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 50034 <at> debbugs.gnu.org (full text, mbox):
Daniel Mendler <mail <at> daniel-mendler.de> writes:
> Steps to reproduce:
>
> 1. Start "emacs -Q"
> 2. Enter "(defmacro foo bar" in the scratch buffer
> 3. Press M-<tab> to invoke 'completion-at-point'
>
> The capf will throw the error "Wrong type argument: listp,
> elisp--witness--lisp". This error will be shown on Emacs 27 and Emacs 28.
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'. I'm not quite sure what the correct fix is
here, so I've added Stefan to the CCs. :-)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50034
; Package
emacs
.
(Mon, 22 Aug 2022 13:16:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 50034 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>> 1. Start "emacs -Q"
>> 2. Enter "(defmacro foo bar" in the scratch buffer
>> 3. Press M-<tab> to invoke 'completion-at-point'
>>
>> The capf will throw the error "Wrong type argument: listp,
>> elisp--witness--lisp". This error will be shown on Emacs 27 and Emacs 28.
>
> 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'. I'm not quite sure what the correct fix is
> here, so I've added Stefan to the CCs. :-)
One year later, this problem is still present in Emacs 29. Stefan, do
you have any idea what the fix here should be?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50034
; Package
emacs
.
(Tue, 23 Aug 2022 02:06:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 50034 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> It fails here:
>
> (`(lambda ,args . ,body)
> (elisp--local-variables-1
> (append (remq '&optional (remq '&rest args)) vars)
> (car (last body))))
I have the impression that the clause before that is supposed to match
in this case (also see the FIXME). It doesn't because the defmacro
macro expander adds an explicit `nil' body, i.e. the body is not empty
as assumed in that clause.
Michael.
Reply sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
You have taken responsibility.
(Tue, 23 Aug 2022 14:19:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Daniel Mendler <mail <at> daniel-mendler.de>
:
bug acknowledged by developer.
(Tue, 23 Aug 2022 14:19:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 50034-done <at> debbugs.gnu.org (full text, mbox):
> 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)
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 21 Sep 2022 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 218 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.