From ef9f5c672a8e248dd7bd682101c03feb2e527340 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Tue, 25 Apr 2017 08:39:17 -0400 Subject: [PATCH] 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index cb77148c285..83456fc31a2 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -727,6 +727,9 @@ Complete list of commands: \\{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.39.2