]> git.eshelyaron.com Git - emacs.git/commit
(backtrace--print-func-and-args): Fix (part of) bug#70436
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 20 Apr 2024 15:23:58 +0000 (11:23 -0400)
committerEshel Yaron <me@eshelyaron.com>
Mon, 22 Apr 2024 18:35:57 +0000 (20:35 +0200)
commitd57f6d72d1e16b4fa148f1db1d55f13f958aae2c
treef39936fc95304fa155883aa6803cf9024c393747
parentc9f184b4378a0fd6a69aed7a9ca50dd733b07937
(backtrace--print-func-and-args): Fix (part of) bug#70436

The source of bug#70436 is that we print a value into the buffer
and then we generate its print representation a second time to
get its length to find the bounds of the thing we just printed.
Not only it's wasteful, but it risks bugs because the two
"prints" can be inconsistent with each other.

This is not a complete fix because in the non EVALD case we
still use that same broken way.

* lisp/emacs-lisp/backtrace.el (backtrace--print-func-and-args):
Don't re-print things just to get their length.
(backtrace--print-to-string): Skip a temp-buffer indirection.

(cherry picked from commit 0536b96011d24797d16d97a59a62f633a3d30472)
lisp/emacs-lisp/backtrace.el