From: Gemini Lasswell <gazally@runbox.com>
To: emacs-devel@gnu.org
Subject: backtrace-mode
Date: Tue, 19 Jun 2018 15:58:44 -0700 [thread overview]
Message-ID: <871sd2mli3.fsf@runbox.com> (raw)
Hello all,
Elisp backtraces are printed in 3 places (subr.el, edebug.el and
debug.el) and displayed in buffers in 3 places (debug.el, edebug.el
and ert.el) without much shared code. I wanted to improve Edebug's
backtraces, and then to make the same things work in ERT and the
debugger without writing it all 3 times, which got me started writing
a backtrace library.
I've just pushed a new branch scratch/backtrace-mode, containing a new
file backtrace.el with the shared backtrace code and a new
backtrace-mode with better backtrace viewing, along with changes to
ERT, Edebug and the debugger to make them all use it, and supporting
changes in cl-print.el.
This code is a Work In Progress, still liberally sprinkled with TODOs.
But it works and can do nifty stuff like pretty-print backtrace frames
and expand "..."s, so please give it a try and let me know what you
think. (It's my first major mode and my first time doing anything
with text properties, so there might be some beginner mistakes.)
Questions:
- debugger-stack-frame-as-list now seems like it should be in
backtrace mode's defcustoms instead of the debugger's. Should it be
moved or left where it is?
- Should I move the backtrace related functions from subr.el to
backtrace.el? There's a function in backtrace.el currently called
backtrace-backtrace which could replace subr's backtrace.
- I haven't made a menu yet, but I assume backtrace-mode should have
one. Should I use easy-menu-define for that, and why doesn't
debug.el use easy-menu-define?
- When you enter the debugger, or when you ask ERT to show a
backtrace, both of them pop to the backtrace buffer. But when you
ask Edebug to show a backtrace, it just shows the backtrace buffer.
I think all three should do the same thing. Now that Edebug's
backtrace has commands other than quit, I think it should also be
popped to. Any objections?
- Now that xref-find-definitions works in backtrace buffers, I think
it would be better to stop making buttons for the functions in a
backtrace, and to document M-. as the best way to jump to function
definitions from backtraces. What do you think of this change to
existing behavior, with or without a new customization variable to
preserve the old behavior?
- backtrace--print-to-string (which tries to find values of
print-length and print-level to fit the printed representation of an
object into a specified number of characters) and ellipsis expansion
would also be useful for ERT, edebug and debug results printing. If
that happens, a way to expand ellipses in *Messages* would be
nice. So maybe these features don't belong in backtrace.el,
but I don't know where they do belong.
- Tab and backtab are used by button navigation. Seems to me the next
best choice for bindings for pretty printing and collapsing back to
one line are '+' and '-' except '-' is bound to negative-argument
in special-mode. So I'm currently using '+' and '=', but I don't
like the '='. Would it be ok to rebind '-' in backtrace buffers?
Bugs fixed in this branch:
- 18609, fontification in backtraces
- 18558, debugger slow with long strings
- 15749, *Backtrace* loses text scaling
- 1428, links in Edebug backtraces
On my todo list:
- bug#14081, add a link to "reading at buffer pos ..."
- A new command for Edebug backtraces only, 's' to jump to the source
code for the frame at point. I'm planning on adding an indicator in
the left margin (where the regular debugger puts its *) to show
whether the source is available for a given frame, since the frames
in a backtrace might be a mix of code instrumented and not
instrumented by Edebug.
Gemini
next reply other threads:[~2018-06-19 22:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-19 22:58 Gemini Lasswell [this message]
2018-06-20 5:52 ` backtrace-mode Helmut Eller
2018-06-22 0:08 ` backtrace-mode Gemini Lasswell
2018-06-22 2:07 ` backtrace-mode Stefan Monnier
2018-06-22 5:41 ` backtrace-mode Gemini Lasswell
2018-06-20 12:32 ` backtrace-mode Stefan Monnier
2018-06-20 15:23 ` backtrace-mode Filipp Gunbin
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=871sd2mli3.fsf@runbox.com \
--to=gazally@runbox.com \
--cc=emacs-devel@gnu.org \
/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).