Subject: Re: bug#26650: 26.0.50; Protect *Backtrace* from accidental killing

From: Tino Calancha <[email-masked]>
Date: Wed, 26 Apr 2017 19:36:54 +0900 (JST)

On Wed, 26 Apr 2017, Eli Zaretskii wrote:

>> From: [email-masked]
>> Date: Tue, 25 Apr 2017 08:50:00 -0400
>> Cc: [email-masked]
>>
>> 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)
>
> This will throw to top-level when _any_ buffer is killed, as long as
> we are in recursive-edit, no?
No, because `add-hook' is called with non-nil LOCAL arg.
> Shouldn't this hook do that only for *Backtrace*?
We can sandwich add-hook inside:
(when (eq (current-buffer) (get-buffer "*Backtrace*"))
   (add-hook ...
)

Then would be less general: just protect *Backtrace* for accidental 
killing.  So far that was my request so i'm fine with that.