From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Gregory Heytings <gregory@heytings.org>
Cc: 60568@debbugs.gnu.org, yantar92@posteo.net,
Eli Zaretskii <eliz@gnu.org>,
mardani29@yahoo.es
Subject: bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions
Date: Fri, 06 Jan 2023 19:36:04 -0500 [thread overview]
Message-ID: <jwvh6x3chox.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <371ba1d0be96347bdf60@heytings.org> (Gregory Heytings's message of "Fri, 06 Jan 2023 22:52:32 +0000")
>>>>> What about the attached patch? It seems to work well.
>>>> SGTM. With which cases did you test this?
>>>> Adding Stefan, in case he has any comments.
>> SGTM as well.
> TBH, I'm not sure this is useful anymore, if the 'definition-name' slot is
> supposed to be used for such functions (which I didn't know). WDYT?
If you look at the code of `find-func.el` you'll see that we already
rely on heuristics, so it seems like a natural complement.
But I agree that `definition-name` is usually preferable since it's more
reliable. Still most people don't know `definition-name`, so it can
still be helpful.
>> - We probably want to use `advice-cd*r` so as to flatten the actual
>> function definition rather than the combination of its definition with the
>> various pieces of advice that are currently applied.
> You mean, (flatten-tree (advice--cd*r (symbol-function fun))), right?
Yes.
>> - The above works for non-compiled functions but for byte-compiled
>> functions we need an ad-hoc version of `flatten-tree` which extracts the
>> constants from the constant vector of bytecode objects (also recursively
>> since bytecode objects tend to contain other bytecode objects).
>>
>> For native-compiled functions, we may be able to get some kind of
>> "constant vector" as well, but I don't think that's currently accessible
>> from ELisp. We should ask Andrea.
>
> Are such dynamically defined functions not always non-compiled, by
> definition?
No. They can be defined by macros rather than functions in which case
they'll usually be compiled. Or they may be closures defined locally
within another defun, in which case again they'll usually be compiled.
[ E.g. with the patch to `ob-shell.el` that I sent, the
`org-babel-execute:sh` is byte-compiled. ]
> At least with the original recipe in this feature request,
> (symbol-file 'org-babel-execute:sh) returns "lisp/org/ob-shell.elc", so it
> has been created by a byte-compiled function.
The `ob-shell.el` code in master creates the functions at run time via
`eval`, so they're created while loading `ob-shell.elc` but
they're interpreted. With my patch, they're just closures so their body
is compiled when `ob-shell.el` is compiled.
Stefan
next prev parent reply other threads:[~2023-01-07 0:36 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-05 7:56 bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions Ihor Radchenko
2023-01-05 8:09 ` Eli Zaretskii
2023-01-05 8:20 ` Ihor Radchenko
2023-01-05 8:32 ` Eli Zaretskii
2023-01-05 17:04 ` Jean Louis
2023-01-05 17:03 ` Jean Louis
2023-01-05 9:40 ` Gregory Heytings
2023-01-05 9:52 ` Gregory Heytings
2023-01-05 10:45 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-05 10:52 ` Ihor Radchenko
2023-01-05 11:20 ` Eli Zaretskii
2023-01-05 12:33 ` Gregory Heytings
2023-01-05 14:16 ` Eli Zaretskii
2023-01-05 14:27 ` Gregory Heytings
2023-01-05 15:10 ` Eli Zaretskii
2023-01-05 15:13 ` Gregory Heytings
2023-01-05 16:49 ` Eli Zaretskii
2023-01-05 20:44 ` Gregory Heytings
2023-01-06 6:35 ` Eli Zaretskii
2023-01-06 9:11 ` Gregory Heytings
2023-01-06 17:27 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-06 22:52 ` Gregory Heytings
2023-01-07 0:36 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-01-07 6:55 ` Eli Zaretskii
2023-01-07 9:42 ` Gregory Heytings
2023-01-07 13:38 ` Ihor Radchenko
2023-01-07 14:00 ` Eli Zaretskii
2023-01-07 14:04 ` Gregory Heytings
2023-01-07 15:07 ` Ihor Radchenko
2023-01-07 15:14 ` Eli Zaretskii
2023-01-07 15:19 ` Ihor Radchenko
2023-01-07 15:23 ` Eli Zaretskii
2023-01-07 17:59 ` Eli Zaretskii
2023-01-07 13:14 ` Ihor Radchenko
2023-01-07 13:55 ` Eli Zaretskii
2023-01-05 17:00 ` Jean Louis
2023-01-06 8:39 ` Ihor Radchenko
2023-01-06 16:44 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-07 11:32 ` Ihor Radchenko
2023-01-07 15:44 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-12 10:40 ` Ihor Radchenko
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=jwvh6x3chox.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=60568@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=gregory@heytings.org \
--cc=mardani29@yahoo.es \
--cc=monnier@iro.umontreal.ca \
--cc=yantar92@posteo.net \
/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.