[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#66750: Unhelpful text in C-h v for variables with a lambda form as v
From: |
Eli Zaretskii |
Subject: |
bug#66750: Unhelpful text in C-h v for variables with a lambda form as value |
Date: |
Sat, 28 Oct 2023 21:38:36 +0300 |
> 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?
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value, Alan Mackenzie, 2023/10/25
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value, Andrea Corallo, 2023/10/25
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value, Alan Mackenzie, 2023/10/27
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value, Alan Mackenzie, 2023/10/28
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value, Stefan Kangas, 2023/10/28
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value, Alan Mackenzie, 2023/10/28
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value, Eli Zaretskii, 2023/10/28
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value, Alan Mackenzie, 2023/10/28
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value, Stefan Monnier, 2023/10/28
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value, Alan Mackenzie, 2023/10/28
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value,
Eli Zaretskii <=
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value, Alan Mackenzie, 2023/10/28
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value, Stefan Monnier, 2023/10/28
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value, Alan Mackenzie, 2023/10/28
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value, Stefan Monnier, 2023/10/29
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value, Alan Mackenzie, 2023/10/29
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value, Stefan Monnier, 2023/10/29
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value, Alan Mackenzie, 2023/10/29
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value, Stefan Monnier, 2023/10/29
- bug#66750: Unhelpful text in C-h v for variables with a lambda form as value, Alan Mackenzie, 2023/10/30