From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Gemini Lasswell Newsgroups: gmane.emacs.devel Subject: backtrace-mode Date: Tue, 19 Jun 2018 15:58:44 -0700 Message-ID: <871sd2mli3.fsf@runbox.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1529449032 19284 195.159.176.226 (19 Jun 2018 22:57:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 19 Jun 2018 22:57:12 +0000 (UTC) User-Agent: mu4e 0.9.18; emacs 26.1.50 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 20 00:57:08 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fVPYi-0004w7-1k for ged-emacs-devel@m.gmane.org; Wed, 20 Jun 2018 00:57:08 +0200 Original-Received: from localhost ([::1]:45291 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVPan-0007xu-PK for ged-emacs-devel@m.gmane.org; Tue, 19 Jun 2018 18:59:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50049) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVPah-0007xn-6t for emacs-devel@gnu.org; Tue, 19 Jun 2018 18:59:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVPae-0006Yu-5B for emacs-devel@gnu.org; Tue, 19 Jun 2018 18:59:11 -0400 Original-Received: from aibo.runbox.com ([91.220.196.211]:35470) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fVPad-0006YA-O3 for emacs-devel@gnu.org; Tue, 19 Jun 2018 18:59:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=rbselector1; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=fXr9lOf2RrYvTEqIiur7ESQkygl9SMo6rtTOFUjBhCo=; b=np0yx0JKwFcJfvdSmlUWcyz/F MvqhJY8J0tPV8PVAxm1gct9j+qrGTo+IU/dv+uQVcU/G/ffc5flPzvobTdAIAhsCEcI9MaFwDufko xuhG6OxVEibLQUZwcMVpwjoaqeuNJ1mlaqj44FhcEBmMtHxd/1LppDgud4FRsYmvVFfbKx31BseNk Vmyjty5QYoFZymHCMioZjBf6HoOpf2gU7FVkgobhOzxoxzYXDpn5le4uNeYfzTt56yeF9t4O83Qqq NEUYoYL5+Lrss5symF9tlVl9WtvT45pIQvlC9pqIjDOhdj0KRbe+Vi1X+31mSlxFuVnzXW3MKZsv8 0Co5WEQlw==; Original-Received: from [10.9.9.212] (helo=mailfront12.runbox.com) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1fVPab-0002el-9b for emacs-devel@gnu.org; Wed, 20 Jun 2018 00:59:05 +0200 Original-Received: from c-24-22-244-161.hsd1.wa.comcast.net ([24.22.244.161] helo=chinook) by mailfront12.runbox.com with esmtpsa (uid:179284 ) (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1fVPaI-0003x3-7q for emacs-devel@gnu.org; Wed, 20 Jun 2018 00:58:46 +0200 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 91.220.196.211 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:226541 Archived-At: 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