GNU bug report logs - #26650
26.0.50; Protect *Backtrace* from accidental killing

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Tue, 25 Apr 2017 12:03:02 UTC

Severity: minor

Tags: fixed, patch

Found in version 26.0.50

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


Message #16 received at 26650 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 26650 <at> debbugs.gnu.org
Subject: Re: bug#26650: 26.0.50; Protect *Backtrace* from accidental killing
Date: Tue, 25 Apr 2017 08:50:00 -0400
[Message part 1 (text/plain, inline)]
tags 26650 patch
quit

Tino Calancha <tino.calancha <at> gmail.com> writes:

>>
>> That's because you're still in the recursive edit, it's like evaluating
>> '(error "hi")' before hitting 'q' in the *Backtrace* buffer.  You can
>> use C-M-c (exit-recursive-edit) to get back to normal.  I think it would
>> make sense to do that automatically if you kill the *Backtrace* buffer.
> Yes, it would be useful.  I don't know how, though.
> Sometimes i kill *Bactrace* from *Ibuffer*/*Buffer List* with the
> recursive edit still ongoing.  It's a classical mistake.

Actually, the obvious way of adding `top-level' (that's what 'q' does)
to `kill-buffer-hook' does protect *Backtrace* from killing.

[v1-0001-Protect-Backtrace-from-being-killed-Bug-26650.patch (text/x-diff, inline)]
From 9e2f66a300cc0c94fb1369cbf3721d41d98c2d94 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Tue, 25 Apr 2017 08:39:17 -0400
Subject: [PATCH v1] Protect *Backtrace* from being killed (Bug#26650)

* lisp/emacs-lisp/debug.el (debugger-mode): Call `top-level' in
`kill-buffer-hook'.
---
 lisp/emacs-lisp/debug.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index 94b683dcb9..0aef94f1d2 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -753,6 +753,8 @@ debugger-mode
 \\{debugger-mode-map}"
   (setq truncate-lines t)
   (set-syntax-table emacs-lisp-mode-syntax-table)
+  (add-hook 'kill-buffer-hook
+            (lambda () (if (> (recursion-depth) 0) (top-level))) nil t)
   (use-local-map debugger-mode-map))
 
 (defcustom debugger-record-buffer "*Debugger-record*"
-- 
2.11.1


This bug report was last modified 8 years and 2 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.