all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: German Pacenza <germanp82@hotmail.com>, 58396@debbugs.gnu.org
Subject: bug#58396: 29.0.50; Optimization failure for add-to-list
Date: Mon, 10 Oct 2022 10:59:04 -0400	[thread overview]
Message-ID: <jwvwn97wx0x.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87fsfwnkl4.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 10 Oct 2022 10:34:15 +0200")

Lars Ingebrigtsen [2022-10-10 10:34:15] wrote:
> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>>> emacs -Q
>>> (setq tab-always-indent 'complete)
>>> (add-to-list pac ;; without the quote. Press TAB after the 'c'
>>>
>>> Result:
>>> Completion succeeds but I get the following in the echo area:
>>> Warning: Optimization failure for add-to-list: Handler:
>>> add-to-list--anon-cmacro
>>> (wrong-number-of-arguments #<subr add-to-list--anon-cmacro> 2)
>>>
>>> With toggle-debug-on-error:
>>>
>>>   Debugger entered--Lisp error: (wrong-number-of-arguments #<subr
>>> add-to-list--anon-cmacro> 2)
>>
>> This seems like it's the same problem as reported in bug#58148 (so I'm
>> merging the two reports).
>
> I don't quite understand the calling sequence how we end up here; I've
> added Stefan to the CCs -- he wrote `elisp--local-variables' back in
> 2014:
>
> Debugger 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)
>   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 -0x18f8a3887af7552>)(((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()

Hmm... we should arrange for this `macroexpand-all` call not to emit any
messages (and it should arguably also skip the compiler-macros) since we
know it'll often be used on code that's not (yet) valid.

I'm not sure which part you don't understand above, so I'll only explain
the general situation: to allow completion of local variable names, we
analyze the surrounding code, but in order to do that without having to
write ad-hoc code that knows about all the macros out there that can
introduce new vars, we take the "surrounding code" and macroexpand the
hell out of it so that we can then traverse the result looking only for
`let/let*/lambda/condition-case`.


        Stefan






  reply	other threads:[~2022-10-10 14:59 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-09 16:20 bug#58396: 29.0.50; Optimization failure for add-to-list German Pacenza
2022-10-10  8:25 ` Lars Ingebrigtsen
2022-10-10  8:34   ` Lars Ingebrigtsen
2022-10-10 14:59     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-10-11  0:28       ` Lars Ingebrigtsen
2022-10-11  1:53         ` Drew Adams
2022-10-11  3:46         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-11 18:27           ` Lars Ingebrigtsen
2022-10-11 19:13             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-12 10:54               ` Lars Ingebrigtsen
2023-09-26 20:30                 ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-26 21:32                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-26 21:48                     ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-26 22:06                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-30 10:39                         ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-30 13:56                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-30 18:44                             ` bug#58396: bug#58148: 29.0.50; Wrong number of arguments in keymap-set--anon-cmacro Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-05 18:07                               ` bug#60081: " Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-03 19:04                             ` bug#58396: 29.0.50; Optimization failure for add-to-list Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-30 14:26                           ` Eli Zaretskii
2023-09-30 18:51                             ` bug#58148: 29.0.50; Wrong number of arguments in keymap-set--anon-cmacro Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-30 18:54                               ` Eli Zaretskii
2023-09-30 22:03                             ` bug#58396: 29.0.50; Optimization failure for add-to-list Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvwn97wx0x.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=58396@debbugs.gnu.org \
    --cc=germanp82@hotmail.com \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.