Subject: bug#60081: closed (Re: bug#58148: 29.0.50; Wrong number of arguments in keymap-set--anon-cmacro)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 05 Oct 2023 18:08:04 +0000

Your bug report

#60081: 29.0.60; compiler-macros in keymap.el accept wrong number of arguments

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
60081: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60081
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#58148: 29.0.50; Wrong number of arguments in keymap-set--anon-cmacro
From: Stefan Monnier <[email-masked]>
To: Jens Schmidt <[email-masked]>
Cc: [email-masked], German Pacenza <[email-masked]>, [email-masked], [email-masked], Lars Ingebrigtsen <[email-masked]>, Eli Zaretskii <[email-masked]>
Date: Thu, 05 Oct 2023 14:07:01 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

>> 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

Subject: 29.0.60; compiler-macros in keymap.el accept wrong number of arguments
From: Zehao Hu <[email-masked]>
To: [email-masked]
Date: Wed, 14 Dec 2022 23:23:57 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Dear maintainer,

When I was trying the new function `keymap-set', a
"wrong-number-of-arguments" error occurred (see below) when
`company-capf' or `completion-at-point' tried to complete
the arguments.

The compiler macro confused me:
(declare (compiler-macro (lambda (form) (keymap--compile-check key) form)))

If I understand correctly, the compiler macro here should be like:
(lambda (form &optional keymap key definition)
  (keymap--compile-check key)
  form)
Or (lambda (form &rest args) ...) because `elisp--witness--lisp' would
be the argument when completing.

However the current one only accept one argument.
And most of compiler-macros in keymap.el (like keymap-global-*
keymap-local-*)
have similar problems.

Part of the backtrace:
entered--Lisp error:
(wrong-number-of-arguments ((t) (form keymap key definition) (ignore keymap
key definition) (keymap--compile-check key) form) 2)
keymap-set--anon-cmacro((keymap-set elisp--witness--lisp)
elisp--witness--lisp)
...

In GNU Emacs 29.0.60 (build 5, x86_64-pc-linux-gnu, GTK+ Version
 3.24.35, cairo version 1.17.6) of 2022-12-14 built on legion7
Repository revision: 1d3cbba7dfa26fc74df4d09d40a3cd7ba07279b4
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Arch Linux

Configured using:
 'configure -C --with-xwidgets --with-json --with-tree-sitter
 --with-mailutils --with-small-ja-dic --with-cairo --with-x-toolkit=gtk3
 'CFLAGS=-march=native -mtune=generic -O2 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection -flto=auto'
 'LDFLAGS=-Wl,-O2,--sort-common,--as-needed,-z,relro,-z,now -flto=auto''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY
PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LANG: en_US
  value of $XMODIFIERS: @im=fcitx
  locale-coding-system: iso-latin-1-unix

Major mode: Fundamental

Minor modes in effect:
  zel-keys: t
  global-hl-line-mode: t
  org-roam-db-autosync-mode: t
  electric-pair-mode: t
  auto-insert-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug paredit edmacro kmacro company-oddmuse
company-keywords company-etags etags fileloop company-gtags
company-dabbrev-code company-dabbrev company-files company-clang
company-capf company-cmake company-semantic company-template
company-bbdb company pcase zel-keys xah-fly-keys dired-x finder-inf
org-ref org-ref-core org-ref-glossary org-ref-bibtex avy doi-utils
url-http url-auth url-gw nsm message sendmail yank-media puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils
mailheader org-ref-utils org-ref-export citeproc citeproc-itemgetters
citeproc-biblatex parse-time citeproc-bibtex ol-bibtex citeproc-cite
citeproc-subbibs citeproc-sort citeproc-name citeproc-formatters
citeproc-number rst compile citeproc-proc citeproc-disamb
citeproc-itemdata citeproc-generic-elements citeproc-macro
citeproc-choose citeproc-date citeproc-context citeproc-prange
citeproc-style citeproc-locale citeproc-term citeproc-rt citeproc-lib
citeproc-s thingatpt queue ox-org ox-odt rng-loc rng-uri rng-parse
rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok
nxml-util ox-latex ox-icalendar org-agenda ox-html table ox-ascii
ox-publish ox org-ref-misc-links org-ref-label-link org-ref-ref-links
org-ref-citation-links xref project org-ref-bibliography-links hydra lv
bibtex-completion filenotify biblio biblio-download biblio-dissemin
biblio-ieee biblio-hal biblio-dblp biblio-crossref biblio-arxiv timezone
biblio-doi biblio-core let-alist url-queue url-file ido hl-line parsebib
bibtex iso8601 f f-shortdoc shortdoc text-property-search s cl-extra
help-mode emacsql-sqlite-builtin sqlite kinsoku zel-scheduled
org-roam-migrate org-roam-log org-roam-mode org-roam-capture org-roam-id
org-roam-node org-roam-db org-roam-utils org-roam-compat org-roam
org-capture org-element org-persist xdg avl-tree generator org-attach
org-id org-refile org ob ob-tangle ob-ref ob-lob ob-table ob-exp
org-macro org-src ob-comint org-pcomplete pcomplete comint ansi-osc
ansi-color ring org-list org-footnote org-faces org-entities time-date
noutline outline icons ob-emacs-lisp ob-core ob-eval org-cycle org-table
ol org-fold org-fold-core org-keys oc org-loaddefs find-func cal-menu
calendar cal-loaddefs org-version org-compat org-macs emacsql-sqlite
advice emacsql emacsql-compiler magit-section format-spec compat-27
compat-26 compat compat-macs rx dash elec-pair autoinsert cus-load
tango-dark-theme loadhist zel-utils zel zel-autoload zel-performance
orderless-autoloads ivy-bibtex-autoloads ivy-avy-autoloads
org-ref-autoloads helpful-autoloads corfu-autoloads
xah-fly-keys-autoloads sudo-edit-autoloads marginalia-autoloads
ebib-autoloads emacsql-sqlite-builtin-autoloads markdown-mode-autoloads
diminish-autoloads paredit-autoloads counsel-autoloads swiper-autoloads
ivy-autoloads exiftool-autoloads async-autoloads elisp-refs-autoloads
major-mode-hydra-autoloads pretty-hydra-autoloads hydra-autoloads
lv-autoloads ace-pinyin-autoloads pinyinlib-autoloads avy-autoloads
rime-autoloads popup-autoloads ox-pandoc-autoloads ht-autoloads
htmlize-autoloads embark-consult-autoloads consult-autoloads
embark-autoloads org-roam-ui-autoloads websocket-autoloads
simple-httpd-autoloads pdf-tools-autoloads tablist-autoloads
nov-autoloads esxml-autoloads kv-autoloads org-roam-bibtex-autoloads
bibtex-completion-autoloads biblio-autoloads biblio-core-autoloads
org-roam-autoloads emacsql-sqlite-autoloads emacsql-autoloads
vertico-autoloads yaml-autoloads org-contrib-autoloads
magit-section-autoloads compat-autoloads citeproc-autoloads
parsebib-autoloads string-inflection-autoloads queue-autoloads
f-autoloads dash-autoloads posframe-autoloads s-autoloads
company-auctex-autoloads auctex-autoloads tex-site info
company-autoloads yasnippet-autoloads package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads xwidget-internal dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit
xinput2 x multi-tty make-network-process emacs)

Memory information:
((conses 16 424057 246088)
 (symbols 48 32234 2)
 (strings 32 156896 32514)
 (string-bytes 1 4311685)
 (vectors 16 55310)
 (vector-slots 8 647804 520395)
 (floats 8 261 1330)
 (intervals 56 1139 601)
 (buffers 984 13))