From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: acorallo@gnu.org, 66750@debbugs.gnu.org,
monnier@iro.umontreal.ca, acm@muc.de, stefankangas@gmail.com
Subject: bug#66750: Unhelpful text in C-h v for variables with a lambda form as value
Date: Sat, 28 Oct 2023 18:59:14 +0000 [thread overview]
Message-ID: <ZT1aAg7G0Ob5bAE8@ACM> (raw)
In-Reply-To: <838r7md237.fsf@gnu.org>
Hello, Eli.
On Sat, Oct 28, 2023 at 21:38:36 +0300, Eli Zaretskii wrote:
> > Cc: 66750@debbugs.gnu.org, Andrea Corallo <acorallo@gnu.org>,
> > Stefan Kangas <stefankangas@gmail.com>, acm@muc.de
> > Date: Sat, 28 Oct 2023 18:17:04 +0000
> > From: Alan Mackenzie <acm@muc.de>
> > > but that's 127kB, so ... could [you] briefly describe the overall design
> > > (IOW, how it's seen by ELisp programmers, byte-compiler hackers, and
> > > ELisp users)?
> > Certainly. Each lambda expression has (usually) a defun within which it
> > is defined. Sometimes it's in a defvar, or defcustom. That
> > @dfn{defining symbol} is recorded in the lambda form in one of three
> > ways:
> > (i) For a cons form, it's (cadr form), a new field inserted between the
> > symbol `lambda' and the argument list.
> > (ii) For a byte-compiled form, it's (aref form 5), this new field going
> > after the doc string and before any interactive form in the compiled
> > form.
> > (iii) For a native-compiled subr it's (subr-native-defining-symbol
> > subr), a function defined in data.c. It accesses a new field in struct
> > Lisp_Subr called defining_symbol.
> > There are lots of detailed changes in eval.c and bytecomp.el (and
> > friends). Also the macro `lambda' in subr.el has been amended to insert
> > the current global defining-symbol if there isn't already a non-nil
> > symbol in that position. cl-print-object/compiled-function has been
> > amended to print the defining-symbol, and there is a new
> > cl-print-object/subr which does the same.
> > The intention is that compiled objects from earlier Emacsen can still be
> > loaded and run by feature/named-lambdas, just without the defining
> > symbols (which will appear to be nil).
> > > Also, what other approaches have you considered/tried and what were the
> > > problems you've encountered, if any?
> > feature/named-lambdas was originally intended for use in backtraces.
> > For the current bug, I've considered individually replacing each lambda
> > with a named defun, so that C-h v will show that name rather than an
> > unhelpful byte/native compiled anonymous function. That would be a lot
> > of work - my scripting found 63 defcustoms set to lambdas, 29 uses in
> > doc strings, and 215 suspicious occurrences with ordinary variables
> > (quite a few of which will be harmless). Amending all these (I guess
> > around 200 lambdas) would probably be too much work.
> Thanks. However, now I'm confused: what exactly does this feature
> give us, if it doesn't handle all the lambdas in the Emacs tree and
> (AFAIU) will not affect lambdas in third-party packages? Which
> lambdas will now have a defining symbol, and which will not?
It will handle all the lambdas in the Emacs tree. Each of them will get
a defining-symbol set. Also third-party packages with lambdas will also
get defining-symbols, provided they are compiled with
feature/named-lambdas. It's just that .elc's/.eln's built with, say,
Emacs-29 will continue to be loadable and runnable, but obviously without
the defining symbol facility for those lambdas.
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2023-10-28 18:59 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-25 17:09 bug#66750: Unhelpful text in C-h v for variables with a lambda form as value Alan Mackenzie
2023-10-25 20:53 ` Andrea Corallo
2023-10-27 11:35 ` Alan Mackenzie
2023-10-28 9:27 ` Alan Mackenzie
2023-10-28 15:04 ` Stefan Kangas
2023-10-28 15:59 ` Alan Mackenzie
2023-10-28 16:26 ` Eli Zaretskii
2023-10-28 16:57 ` Alan Mackenzie
2023-10-28 17:17 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-28 18:17 ` Alan Mackenzie
2023-10-28 18:38 ` Eli Zaretskii
2023-10-28 18:59 ` Alan Mackenzie [this message]
2023-10-28 19:13 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-28 19:59 ` Alan Mackenzie
2023-10-29 4:14 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-29 11:25 ` Alan Mackenzie
2023-10-29 16:32 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-29 18:50 ` Alan Mackenzie
2023-10-29 21:47 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-30 9:44 ` Alan Mackenzie
2023-11-01 12:47 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-01 15:03 ` Alan Mackenzie
2023-11-01 18:11 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-01 20:30 ` Alan Mackenzie
2023-11-01 22:46 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-02 6:13 ` Eli Zaretskii
2023-11-02 9:37 ` Alan Mackenzie
2023-11-02 10:09 ` Eli Zaretskii
2023-11-02 11:52 ` Alan Mackenzie
2023-11-02 13:50 ` Eli Zaretskii
2023-11-02 15:55 ` Alan Mackenzie
2023-11-02 16:50 ` Eli Zaretskii
2023-11-02 17:12 ` Andrea Corallo
2023-11-02 21:44 ` Stefan Kangas
2023-11-02 22:24 ` Alan Mackenzie
2023-11-03 3:20 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-03 19:46 ` Alan Mackenzie
2023-11-03 22:18 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-04 15:31 ` Alan Mackenzie
2023-11-26 12:32 ` Alan Mackenzie
2023-11-27 17:23 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-25 12:03 ` Alan Mackenzie
2023-11-02 20:53 ` Stefan Kangas
2023-11-02 21:20 ` bug#66750: help-split-fundoc (was: bug#66750: Unhelpful text in C-h v for variables with a lambda form as value) Stefan Monnier 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZT1aAg7G0Ob5bAE8@ACM \
--to=acm@muc.de \
--cc=66750@debbugs.gnu.org \
--cc=acorallo@gnu.org \
--cc=eliz@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=stefankangas@gmail.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).