From: Lars Ingebrigtsen Date: Tue, 14 Jun 2022 12:38:05 +0000 (+0200) Subject: Leave the contents on the *Backtrace* buffer on `q' X-Git-Tag: emacs-29.0.90~1910^2~9 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a02bb84c80f63a7b1199f0e68d605f7d418167fd;p=emacs.git Leave the contents on the *Backtrace* buffer on `q' * lisp/emacs-lisp/debug.el (debug): Don't clear the contents of the buffer on `q' (bug#55863). --- diff --git a/etc/NEWS b/etc/NEWS index 73416fb30cd..19ca21f666d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -997,6 +997,13 @@ inadvertently delete the "*scratch*" buffer. ** Debugging +--- +*** 'q' in a *Backtrace* buffer no longer clears the buffer. +Instead it just buries the buffer and switches the mode from +'debugger-mode' to 'backtrace-mode', since commands like 'e' are no +longer available after exiting the recursive edit. + ++++ *** New user option 'debug-allow-recursive-debug'. This user option controls whether the 'e' (in a "*Backtrace*" buffer or while edebugging) and 'C-x C-e' (while edebugging) commands diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index 6c172d6c31d..c4929eb2b01 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -305,16 +305,15 @@ the debugger will not be entered." (set-buffer debugger-old-buffer))) ;; Forget debugger window, it won't be back (Bug#17882). (setq debugger-previous-window nil)) - ;; Restore previous state of debugger-buffer in case we were - ;; in a recursive invocation of the debugger, otherwise just - ;; erase the buffer. + ;; Restore previous state of debugger-buffer in case we + ;; were in a recursive invocation of the debugger, + ;; otherwise just exit (after changing the mode, since we + ;; can't interact with the buffer in the same way). (when (buffer-live-p debugger-buffer) (with-current-buffer debugger-buffer (if debugger-previous-state (debugger--restore-buffer-state debugger-previous-state) - (setq backtrace-insert-header-function nil) - (setq backtrace-frames nil) - (backtrace-print)))) + (backtrace-mode)))) (with-timeout-unsuspend debugger-with-timeout-suspend) (set-match-data debugger-outer-match-data))) (setq debug-on-next-call debugger-step-after-exit)