bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61847: debug-early-backtrace only works some of the time.


From: Alan Mackenzie
Subject: bug#61847: debug-early-backtrace only works some of the time.
Date: Fri, 3 Mar 2023 10:58:52 +0000

Hello, Stefan.

On Wed, Mar 01, 2023 at 12:34:04 -0500, Stefan Monnier wrote:
> > the way it prints (or rather used to print) a compiled function is/was
> > useful.  You can see how many arguments it takes.

> Hmm...

> `prin1` will print for example #[256 ...] where 256 is where it tells
> "how many arguments it takes".
> In contrast, `cl-prin1` will print #f(compiled-function (&optional arg) ...)

> So in both cases "you can see how many arguments it takes" (and I'll
> let you guess which one I find more readable).

I find them both equally readable, having practised reading dumped
functions.  But I accept most people won't.

> FWIW, I just tried the `condition-case` wrapper and it fixes the problem
> for the test case you showed.  So I just pushed my patch to
> `emacs-29` (which additionally checks for the presence of
> `cl-defmethod`, which also fixes the problem: one is never too sure).

One is never too sure, which was one of the points of the original
design.

> I'll let you (plural) decide whether to keep using `cl-prin1` or not,
> but now this is not directly related to fixing this bug any more.

You could have reminded me of the variable cl-print-compiled, which at
least allows you to dump the constant vector.

I propose extending this variable thusly:


diff --git a/lisp/emacs-lisp/cl-print.el b/lisp/emacs-lisp/cl-print.el
index 61586526ca1..74dad303a27 100644
--- a/lisp/emacs-lisp/cl-print.el
+++ b/lisp/emacs-lisp/cl-print.el
@@ -165,6 +165,7 @@ 'help-byte-code
 (defvar cl-print-compiled nil
   "Control how to print byte-compiled functions.
 Acceptable values include:
+- `full' to print out the full contents of the function using `prin1'.
 - `static' to print the vector of constants.
 - `disassemble' to print the disassembly of the code.
 - nil to skip printing any details about the code.")

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).





reply via email to

[Prev in Thread] Current Thread [Next in Thread]