From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 54802@debbugs.gnu.org
Subject: bug#54802: OClosure: Make `interactive-form` a generic function
Date: Fri, 15 Apr 2022 08:46:55 +0800 [thread overview]
Message-ID: <87v8vbrx4w.fsf@yahoo.com> (raw)
In-Reply-To: <jwvfsmfft43.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Thu, 14 Apr 2022 14:34:24 -0400")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Do you have actual examples in some existing package?
Just the one I wrote for myself.
> Interesting. I just tested this in an `all-completions` loop and my
> patch makes it run a factor of 2 slower (it went from ~30ms to ~60ms to
> enumerate the 141 commands that matched).
>
> There are some mitigating circumstances, tho:
> - The first call to this code takes a lot of time (~6s) because
> it loads a crapload of packages (every package with a registered
> autoloaded command).
Indeed, that's a problem I know of, but it solves itself after the first
call.
> - It's very brittle since it won't find those commands that have
> interactive specs like "r\np" or where it's not a string (like
> `kill-region` and many others, actually there are regularly more, e.g.
> to make them obey `use-region-p`).
Hmm, I'll try to adapt that code to those commands.
> - That loop signaled an error because of an erroneous autoload in
> `gnus.el` (it's now fixed in `master`), so your code probably did
> not do that.
Somehow I never ran into that.
> One reason is that for the case of advice, I'd much rather compute the
> interactive spec lazily (when the command is called) rather than when
> the advice is built.
>
> Another reason is that there is no dedicated "oclosure slot" for an
> interactive-spec. In theory we could use the byte-code object's slot
> for that, but making it computable (as needed for bug#51695 and for
> advice) would require significant changes to cconv.el and bytecomp.el
> (and to make it not too inconvenient to use in `advice.el` it'd
> additionally require extending the syntax of `interactive`).
>
> We could add a dedicated "oclosure slot" for the interactive-spec, but
> it'd likely be rather ugly, since that would need to be accessed from
> the C in `cmds.c` but would require testing the type of the OClosure
> first and that would have to be written in ELisp since it depends on how
> OClosure types are represented which itself depends on `cl-defstruct`,
> etc...
OClosures are records, right? There's no other record type that can be
a function with an interactive form, so we could just use `recordp'
instead of calling into Lisp for that.
Alternatively, we could try to speed up generic dispatch, but I don't
know that code and as such am devoid of ideas in that direction.
Thanks.
next prev parent reply other threads:[~2022-04-15 0:46 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-08 20:33 bug#54802: OClosure: Make `interactive-form` a generic function Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-09 5:58 ` Eli Zaretskii
2022-04-09 13:50 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-10 12:45 ` Lars Ingebrigtsen
2022-04-13 7:53 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-14 18:34 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-15 0:46 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-04-15 1:18 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-15 1:37 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-15 3:24 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-15 4:27 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-15 16:08 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-15 16:14 ` Eli Zaretskii
2022-04-18 22:59 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-19 5:40 ` Eli Zaretskii
2022-04-19 12:38 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-19 12:43 ` Lars Ingebrigtsen
2022-04-19 13:00 ` Eli Zaretskii
2022-04-19 13:34 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-19 13:53 ` Eli Zaretskii
2022-04-19 14:53 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-19 16:35 ` Eli Zaretskii
2022-04-19 17:52 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-26 14:38 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-27 16:05 ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-11 21:24 ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-12 5:34 ` Eli Zaretskii
2022-06-12 20:56 ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
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=87v8vbrx4w.fsf@yahoo.com \
--to=bug-gnu-emacs@gnu.org \
--cc=54802@debbugs.gnu.org \
--cc=luangruo@yahoo.com \
--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.