GNU bug report logs -
#58148
29.0.50; Wrong number of arguments in keymap-set--anon-cmacro
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Wed, 28 Sep 2022 18:04:01 UTC
Severity: normal
Merged with 58396,
58557
Found in version 29.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 58148 in the body.
You can then email your comments to 58148 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#58148
; Package
emacs
.
(Wed, 28 Sep 2022 18:04:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> linkov.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 28 Sep 2022 18:04:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
0. emacs -Q
1. Type in the *scratch*:
(keymap-set g
2. Then 'completion-at-point' with 'M-C-i'.
Debugger entered--Lisp error: (wrong-number-of-arguments (4 . 4) 2)
keymap-set--anon-cmacro((keymap-set elisp--witness--lisp) elisp--witness--lisp)
apply(keymap-set--anon-cmacro (keymap-set elisp--witness--lisp) elisp--witness--lisp)
macroexp--compiler-macro(keymap-set--anon-cmacro (keymap-set elisp--witness--lisp))
#f(compiled-function (form func) #<bytecode -0x1997929cc4a97ca0>)(((keymap-set elisp--witness--lisp)) keymap-set)
macroexp--expand-all((keymap-set elisp--witness--lisp))
macroexpand-all((keymap-set elisp--witness--lisp))
elisp--local-variables()
#f(compiled-function (string) #<bytecode -0x5dd040ab2d900d4>)(#("g" 0 1 (fontified t rear-nonsticky t)))
#f(compiled-function (string pred action) #<bytecode -0x131cb872953b2efd>)(#("g" 0 1 (fontified t rear-nonsticky t)) nil nil)
try-completion(#("g" 0 1 (fontified t rear-nonsticky t)) #f(compiled-function (string pred action) #<bytecode -0x131cb872953b2efd>) nil)
#f(compiled-function (table) #<bytecode 0x1635acab3bc82542>)(#f(compiled-function (string pred action) #<bytecode -0x131cb872953b2efd>))
mapcar(#f(compiled-function (table) #<bytecode 0x1635acab3bc82542>) (#f(compiled-function (string pred action) #<bytecode -0x131cb872953b2efd>) #f(compiled-function (&rest args2) #<bytecode -0x12a9d92cb5a883a4>)))
#f(compiled-function (string pred action) #<bytecode 0x59c9db15e8e1ece>)(#("g" 0 1 (fontified t rear-nonsticky t)) nil nil)
try-completion(#("g" 0 1 (fontified t rear-nonsticky t)) #f(compiled-function (string pred action) #<bytecode 0x59c9db15e8e1ece>) nil)
completion-basic-try-completion(#("g" 0 1 (rear-nonsticky t fontified t)) #f(compiled-function (string pred action) #<bytecode 0x59c9db15e8e1ece>) nil 1)
#f(compiled-function (style) #<bytecode 0x178271f9e5e4c041>)(basic)
completion--some(#f(compiled-function (style) #<bytecode 0x178271f9e5e4c041>) (basic partial-completion emacs22))
completion--nth-completion(1 #("g" 0 1 (rear-nonsticky t fontified t)) #f(compiled-function (string pred action) #<bytecode 0x59c9db15e8e1ece>) nil 1 (metadata))
completion-try-completion(#("g" 0 1 (rear-nonsticky t fontified t)) #f(compiled-function (string pred action) #<bytecode 0x59c9db15e8e1ece>) nil 1 (metadata))
completion--do-completion(#<marker at 158 in *scratch*> 159)
completion--in-region-1(#<marker at 158 in *scratch*> 159)
#f(compiled-function (start end collection predicate) #<bytecode -0xceba54d1e8420a4>)(#<marker at 158 in *scratch*> 159 #f(compiled-function (string pred action) #<bytecode 0x59c9db15e8e1ece>) nil)
apply(#f(compiled-function (start end collection predicate) #<bytecode -0xceba54d1e8420a4>) (#<marker at 158 in *scratch*> 159 #f(compiled-function (string pred action) #<bytecode 0x59c9db15e8e1ece>) nil))
#f(compiled-function (funs global args) #<bytecode -0xf63b519da3ae62>)(nil nil (#<marker at 158 in *scratch*> 159 #f(compiled-function (string pred action) #<bytecode 0x59c9db15e8e1ece>) nil))
completion--in-region(#<marker at 158 in *scratch*> 159 #f(compiled-function (string pred action) #<bytecode 0x59c9db15e8e1ece>) nil)
completion-in-region(#<marker at 158 in *scratch*> 159 #f(compiled-function (string pred action) #<bytecode 0x59c9db15e8e1ece>) nil)
completion-at-point()
funcall-interactively(completion-at-point)
command-execute(completion-at-point)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#58148
; Package
emacs
.
(Wed, 28 Sep 2022 18:25:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 58148 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
> 1. Type in the *scratch*:
>
> (keymap-set g
>
> 2. Then 'completion-at-point' with 'M-C-i'.
>
> Debugger entered--Lisp error: (wrong-number-of-arguments (4 . 4) 2)
I'm unable to reproduce the problem. Do you still see it after a "make
bootstrap"?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#58148
; Package
emacs
.
(Wed, 28 Sep 2022 19:36:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 58148 <at> debbugs.gnu.org (full text, mbox):
>> 1. Type in the *scratch*:
>>
>> (keymap-set g
>>
>> 2. Then 'completion-at-point' with 'M-C-i'.
>>
>> Debugger entered--Lisp error: (wrong-number-of-arguments (4 . 4) 2)
>
> I'm unable to reproduce the problem. Do you still see it after a "make
> bootstrap"?
Hmm, still fails after bootstrap in the latest master:
Debugger entered--Lisp error: (wrong-number-of-arguments #<subr keymap-set--anon-cmacro> 2)
keymap-set--anon-cmacro((keymap-set elisp--witness--lisp) elisp--witness--lisp)
In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
version 1.16.0, Xaw3d scroll bars) of 2022-09-28
Repository revision: b6a163ba7cdf57eff5542b4cb6956780ebb2880f
Repository branch: master
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#58148
; Package
emacs
.
(Thu, 29 Sep 2022 10:35:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 58148 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
> Hmm, still fails after bootstrap in the latest master:
>
> Debugger entered--Lisp error: (wrong-number-of-arguments #<subr keymap-set--anon-cmacro> 2)
> keymap-set--anon-cmacro((keymap-set elisp--witness--lisp) elisp--witness--lisp)
There was another report of something similar, but that seemed to have
something to do with previously compiled packages, which is why I
thought this might be a stale .elc problem.
I'm wondering why I'm not seeing the issue then -- I tried a "make
bootstrap" and then "emacs -Q" and the recipe, and didn't get any errors.
> In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
> version 1.16.0, Xaw3d scroll bars) of 2022-09-28
> Repository revision: b6a163ba7cdf57eff5542b4cb6956780ebb2880f
> Repository branch: master
I've got:
In GNU Emacs 29.0.50 (build 41, x86_64-pc-linux-gnu, GTK+ Version
3.24.33, cairo version 1.16.0) of 2022-09-28 built on joga
Repository revision: 1254d9a3ae89697b591343de2ddf55c5879bc937
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101003
System Description: Ubuntu 22.04.1 LTS
Could possibly a toolkit version make any difference here? That would
be really weird.
Hm... anybody have any ideas?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#58148
; Package
emacs
.
(Thu, 29 Sep 2022 15:31:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 58148 <at> debbugs.gnu.org (full text, mbox):
>> Hmm, still fails after bootstrap in the latest master:
>>
>> Debugger entered--Lisp error: (wrong-number-of-arguments #<subr keymap-set--anon-cmacro> 2)
>> keymap-set--anon-cmacro((keymap-set elisp--witness--lisp) elisp--witness--lisp)
>
> There was another report of something similar, but that seemed to have
> something to do with previously compiled packages, which is why I
> thought this might be a stale .elc problem.
>
> I'm wondering why I'm not seeing the issue then -- I tried a "make
> bootstrap" and then "emacs -Q" and the recipe, and didn't get any errors.
Sorry, I had an additional setting more than -Q:
(setq debug-on-error t)
I thought it's required to see errors in -Q, because without
debug-on-error, the errors are hidden in *Messages*. And
indeed in this case without debug-on-error *Messages* contains:
Warning: Optimization failure for keymap-set: Handler: keymap-set--anon-cmacro
(wrong-number-of-arguments #<subr keymap-set--anon-cmacro> 2)
Making completion list...
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#58148
; Package
emacs
.
(Fri, 30 Sep 2022 12:38:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 58148 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
> Sorry, I had an additional setting more than -Q:
>
> (setq debug-on-error t)
>
> I thought it's required to see errors in -Q, because without
> debug-on-error, the errors are hidden in *Messages*. And
> indeed in this case without debug-on-error *Messages* contains:
>
> Warning: Optimization failure for keymap-set: Handler: keymap-set--anon-cmacro
> (wrong-number-of-arguments #<subr keymap-set--anon-cmacro> 2)
> Making completion list...
Still not seeing the problem, unfortunately --
emacs -Q
M-: (setq debug-on-error t)
(keymap-set d `C-M-i'
No errors, and nothing in *Messages*, with or without debug-on-error.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#58148
; Package
emacs
.
(Sat, 01 Oct 2022 19:24:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 58148 <at> debbugs.gnu.org (full text, mbox):
>> Warning: Optimization failure for keymap-set: Handler: keymap-set--anon-cmacro
>> (wrong-number-of-arguments #<subr keymap-set--anon-cmacro> 2)
>
> Still not seeing the problem, unfortunately --
>
> emacs -Q
> M-: (setq debug-on-error t)
>
> (keymap-set d `C-M-i'
>
> No errors, and nothing in *Messages*, with or without debug-on-error.
I tried again to bootstrap with extra clean, but still the same error.
We need someone to try this out too that could help to clarify
where is the problem 🧐
Forcibly Merged 58148 58396.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Mon, 10 Oct 2022 08:27:02 GMT)
Full text and
rfc822 format available.
Forcibly Merged 58148 58396 58557.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sun, 16 Oct 2022 09:24:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#58148
; Package
emacs
.
(Sat, 30 Sep 2023 18:46:02 GMT)
Full text and
rfc822 format available.
Message #30 received at 58148 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> + (let ((inhibit-message t) ;[1]
>> + (warning-minimum-log-level :emergency))
>> (advice-add 'macroexpand :around macroexpand-advice)
>> - (macroexpand-all sexp))
>> + (condition-case nil ;[3]
>> + (macroexpand-all sexp)
>> + (t sexp)))
>
> This `t` catches more than errors. Better replace it with `error`.
Done plus Eli's comments from that other branch.
>> - (let ((warning-minimum-log-level :emergency))
>> + (let ((inhibit-message t) ;[1]
>> + (macroexp-inhibit-compiler-macros t) ;[2]
>> + (warning-minimum-log-level :emergency))
>> (advice-add 'macroexpand-1 :around macroexpand-advice)
>> - (macroexpand-all sexp elisp--local-macroenv))
>> + (condition-case nil ;[3]
>> + (macroexpand-all sexp elisp--local-macroenv)
>> + (t sexp)))
>
> What kind of errors are we expecting to catch with this
> `condition-case`? The pre-existing advice is supposed to catch macro
> expansion errors, and the new let-binding is supposed to catch
> compiler-macro errors, so it seems to me there aren't any *expected*
> errors left. If so, better remove this `condition-case` (or replace it
> with `with-demoted-errors`) since all it has left to do is to hide any
> real coding error that may come up and that we'd like to be told about.
Done.
FWIW, bug#60081 can also be merged into this one. (The other bugs that
Zehao mentions in her/his last post are either merged already or
typos/not related to this bug.) Technically, I should be able to merge
that bug (after having been pointed to admin/notes/bugtracker), but is
it OK for me (as a "plain user") to do so? Or should someone with more
authority do that?
Thanks.
[0001-29-Silence-macro-expansion-during-completion-at-point.patch (text/x-diff, inline)]
From f4184086081b9cf94e87848d33b527c35f78ffdf Mon Sep 17 00:00:00 2001
From: Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>
Date: Tue, 26 Sep 2023 22:26:15 +0200
Subject: [PATCH] Silence macro expansion during completion at point
To keep risk in the current release branch low, do not avoid compiler
macros as suggested by Stefan in the bug, but rather suppress all errors.
* lisp/progmodes/elisp-mode.el (elisp--local-variables): Silence
messages. Suppress all errors during macro expansion. (Bug#58148)
Do not merge to master.
---
lisp/progmodes/elisp-mode.el | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index bd3916ce108..354d98c50dc 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -447,9 +447,14 @@ elisp--local-variables
(error form))))
(sexp
(unwind-protect
- (let ((warning-minimum-log-level :emergency))
+ ;; Silence any macro expansion errors when
+ ;; attempting completion at point (bug#58148).
+ (let ((inhibit-message t)
+ (warning-minimum-log-level :emergency))
(advice-add 'macroexpand :around macroexpand-advice)
- (macroexpand-all sexp))
+ (condition-case nil
+ (macroexpand-all sexp)
+ (error sexp)))
(advice-remove 'macroexpand macroexpand-advice)))
(vars (elisp--local-variables-1 nil sexp)))
(delq nil
--
2.30.2
[0001-30-Silence-macro-expansion-during-completion-at-point.patch (text/x-diff, inline)]
From cc954764667e23ecc19ae9cc3fb89956a32289ce Mon Sep 17 00:00:00 2001
From: Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>
Date: Fri, 29 Sep 2023 22:04:43 +0200
Subject: [PATCH] Silence macro expansion during completion at point
* lisp/emacs-lisp/macroexp.el (macroexp-inhibit-compiler-macros): Add
variable.
(macroexp--compiler-macro): Inspect that new variable and, if it is
non-nil, return the input form unchanged.
* lisp/progmodes/elisp-mode.el (elisp--local-variables): Silence
messages. Avoid compiler macros. (Bug#58148)
---
lisp/emacs-lisp/macroexp.el | 20 ++++++++++++++------
lisp/progmodes/elisp-mode.el | 6 +++++-
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index 3ef924a5c73..6eb670d6dc1 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -105,13 +105,21 @@ macroexp--all-clauses
(macroexp--all-forms clause skip)
clause)))
+(defvar macroexp-inhibit-compiler-macros nil
+ "Inhibit application of compiler macros if non-nil.")
+
(defun macroexp--compiler-macro (handler form)
- (condition-case-unless-debug err
- (apply handler form (cdr form))
- (error
- (message "Warning: Optimization failure for %S: Handler: %S\n%S"
- (car form) handler err)
- form)))
+ "Apply compiler macro HANDLER to FORM and return the result.
+Unless `macroexp-inhibit-compiler-macros' is non-nil, in which
+case return FORM unchanged."
+ (if macroexp-inhibit-compiler-macros
+ form
+ (condition-case-unless-debug err
+ (apply handler form (cdr form))
+ (error
+ (message "Warning: Optimization failure for %S: Handler: %S\n%S"
+ (car form) handler err)
+ form))))
(defun macroexp--funcall-if-compiled (_form)
"Pseudo function used internally by macroexp to delay warnings.
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 664299df288..ff90a744ea3 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -460,7 +460,11 @@ elisp--local-variables
(message "Ignoring macroexpansion error: %S" err) form))))
(sexp
(unwind-protect
- (let ((warning-minimum-log-level :emergency))
+ ;; Silence any macro expansion errors when
+ ;; attempting completion at point (bug#58148).
+ (let ((inhibit-message t)
+ (macroexp-inhibit-compiler-macros t)
+ (warning-minimum-log-level :emergency))
(advice-add 'macroexpand-1 :around macroexpand-advice)
(macroexpand-all sexp elisp--local-macroenv))
(advice-remove 'macroexpand-1 macroexpand-advice)))
--
2.30.2
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#58148
; Package
emacs
.
(Sat, 30 Sep 2023 18:53:02 GMT)
Full text and
rfc822 format available.
Message #33 received at 58148 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> Most of this comment should be in the commit log message, I think, and
> the [1] and [3] markers should be replaced with text telling what that
> does. Otherwise, the first patch is okay for the emacs-29 branch.
Updated the patch accordingly and sent it on that other branch of this
thread, please review. However, I removed the [1] and [3] markers
without replacement: I don't think that there is much need to separately
comment on a `condition-case' or a let-binding of `inhibit-message'.
> Regarding the second patch: if Stefan Monnier and Stefan Kangas are
> okay with it, so am I.
Does that mean that I should explicitly draw Stefan Kangas' attention to
this bug? Or would he notice somehow otherwise?
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#58148
; Package
emacs
.
(Sat, 30 Sep 2023 18:56:02 GMT)
Full text and
rfc822 format available.
Message #36 received at 58148 <at> debbugs.gnu.org (full text, mbox):
> From: Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>
> Cc: 58148 <at> debbugs.gnu.org, germanp82 <at> hotmail.com, 58396 <at> debbugs.gnu.org,
> larsi <at> gnus.org, monnier <at> iro.umontreal.ca
> Date: Sat, 30 Sep 2023 20:51:25 +0200
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > Most of this comment should be in the commit log message, I think, and
> > the [1] and [3] markers should be replaced with text telling what that
> > does. Otherwise, the first patch is okay for the emacs-29 branch.
>
> Updated the patch accordingly and sent it on that other branch of this
> thread, please review.
It's fine, thanks.
> > Regarding the second patch: if Stefan Monnier and Stefan Kangas are
> > okay with it, so am I.
>
> Does that mean that I should explicitly draw Stefan Kangas' attention to
> this bug? Or would he notice somehow otherwise?
Just wait for him to chime in, which will happen soon enough.
Reply sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
You have taken responsibility.
(Thu, 05 Oct 2023 18:08:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Juri Linkov <juri <at> linkov.net>
:
bug acknowledged by developer.
(Thu, 05 Oct 2023 18:08:02 GMT)
Full text and
rfc822 format available.
Message #41 received at 58148-done <at> debbugs.gnu.org (full text, mbox):
>> This `t` catches more than errors. Better replace it with `error`.
> Done plus Eli's comments from that other branch.
Thanks, pushed to `emacs-29`.
> Done.
Thanks, pushed to `master`.
> FWIW, bug#60081 can also be merged into this one. (The other bugs that
> Zehao mentions in her/his last post are either merged already or
> typos/not related to this bug.)
Indeed, hereby closing it as well.
> Technically, I should be able to merge that bug (after having been
> pointed to admin/notes/bugtracker), but is it OK for me (as a "plain
> user") to do so?
Yes (it's easy to undo, in any case if it proves to be a mistake).
Stefan
Reply sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
You have taken responsibility.
(Thu, 05 Oct 2023 18:08:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
German Pacenza <germanp82 <at> hotmail.com>
:
bug acknowledged by developer.
(Thu, 05 Oct 2023 18:08:03 GMT)
Full text and
rfc822 format available.
Reply sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
You have taken responsibility.
(Thu, 05 Oct 2023 18:08:03 GMT)
Full text and
rfc822 format available.
Notification sent
to
Disroot <hilde.rhyne <at> disroot.org>
:
bug acknowledged by developer.
(Thu, 05 Oct 2023 18:08:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 03 Nov 2023 11:24:13 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 187 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.