GNU bug report logs -
#26650
26.0.50; Protect *Backtrace* from accidental killing
Previous Next
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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 26650 in the body.
You can then email your comments to 26650 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#26650
; Package
emacs
.
(Tue, 25 Apr 2017 12:03:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Tino Calancha <tino.calancha <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 25 Apr 2017 12:03:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
I often kills the *Backtrace* buffer; then, errors won't show
*Backtrace* again in this session.
Could *Backtrace* be guarded with something like `edebug-kill-buffer'
in kill-buffer-hook?
emacs -Q
;; eval following form:
(error "hi") ; This jump to *Backtrace*
q ; Back to top level
;; Eval it again:
(error "hi") ; This time kill *Backtrace*
C-x k RET
;; Eval it once more:
(error "hi")
;; 'hi' is printed in echo area, but *Backtrace* is not shown.
In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
of 2017-04-25 built
Repository revision: 5b0fdefb4ca54b0d3dac3047ac1e4b380beb6ba7
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#26650
; Package
emacs
.
(Tue, 25 Apr 2017 12:12:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 26650 <at> debbugs.gnu.org (full text, mbox):
severity 26650 minor
quit
Tino Calancha <tino.calancha <at> gmail.com> writes:
> (error "hi") ; This time kill *Backtrace*
> C-x k RET
>
> ;; Eval it once more:
> (error "hi")
> ;; 'hi' is printed in echo area, but *Backtrace* is not shown.
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.
Severity set to 'minor' from 'normal'
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Tue, 25 Apr 2017 12:12:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#26650
; Package
emacs
.
(Tue, 25 Apr 2017 12:19:01 GMT)
Full text and
rfc822 format available.
Message #13 received at 26650 <at> debbugs.gnu.org (full text, mbox):
On Tue, 25 Apr 2017, npostavs <at> users.sourceforge.net wrote:
> severity 26650 minor
> quit
>
> Tino Calancha <tino.calancha <at> gmail.com> writes:
>
>> (error "hi") ; This time kill *Backtrace*
>> C-x k RET
>>
>> ;; Eval it once more:
>> (error "hi")
>> ;; 'hi' is printed in echo area, but *Backtrace* is not shown.
>
> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#26650
; Package
emacs
.
(Tue, 25 Apr 2017 12:49:01 GMT)
Full text and
rfc822 format available.
Message #16 received at 26650 <at> debbugs.gnu.org (full text, mbox):
[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
Added tag(s) patch.
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Tue, 25 Apr 2017 12:49:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#26650
; Package
emacs
.
(Tue, 25 Apr 2017 13:03:01 GMT)
Full text and
rfc822 format available.
Message #21 received at 26650 <at> debbugs.gnu.org (full text, mbox):
On Tue, 25 Apr 2017, npostavs <at> users.sourceforge.net wrote:
> 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.
Good! It solves the issue.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#26650
; Package
emacs
.
(Wed, 26 Apr 2017 10:09:02 GMT)
Full text and
rfc822 format available.
Message #24 received at 26650 <at> debbugs.gnu.org (full text, mbox):
> From: npostavs <at> users.sourceforge.net
> Date: Tue, 25 Apr 2017 08:50:00 -0400
> Cc: 26650 <at> debbugs.gnu.org
>
> 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? Is that a good idea? Shouldn't this
hook do that only for *Backtrace*?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#26650
; Package
emacs
.
(Wed, 26 Apr 2017 10:38:02 GMT)
Full text and
rfc822 format available.
Message #27 received at 26650 <at> debbugs.gnu.org (full text, mbox):
On Wed, 26 Apr 2017, Eli Zaretskii wrote:
>> From: npostavs <at> users.sourceforge.net
>> Date: Tue, 25 Apr 2017 08:50:00 -0400
>> Cc: 26650 <at> debbugs.gnu.org
>>
>> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#26650
; Package
emacs
.
(Wed, 26 Apr 2017 10:50:01 GMT)
Full text and
rfc822 format available.
Message #30 received at 26650 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> > From: npostavs <at> users.sourceforge.net
> > Date: Tue, 25 Apr 2017 08:50:00 -0400
> > Cc: 26650 <at> debbugs.gnu.org
> >
> > 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? Is that a good idea? Shouldn't this
> hook do that only for *Backtrace*?
Did you notice that the lambda is added to the buffer-local binding of
the hook? If you did, I don't understand why this would happen. If you
didn't, maybe a line break should be added after the lambda expression?
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#26650
; Package
emacs
.
(Wed, 26 Apr 2017 11:05:01 GMT)
Full text and
rfc822 format available.
Message #33 received at 26650 <at> debbugs.gnu.org (full text, mbox):
> From: Tino Calancha <tino.calancha <at> gmail.com>
> Date: Wed, 26 Apr 2017 19:36:54 +0900 (JST)
> cc: npostavs <at> users.sourceforge.net, Tino Calancha <tino.calancha <at> gmail.com>,
> 26650 <at> debbugs.gnu.org
>
> >> + (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.
Right, sorry for not paying attention.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#26650
; Package
emacs
.
(Wed, 26 Apr 2017 12:52:01 GMT)
Full text and
rfc822 format available.
Message #36 received at 26650 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> >> + (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.
>
> Right, sorry for not paying attention.
Maybe I should have written
(add-hook 'kill-buffer-hook (lambda ...) nil 'local)
to emphasize this? I'm still undecided on the general style question of
whether to use t or '<symbol> in these cases.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#26650
; Package
emacs
.
(Wed, 26 Apr 2017 13:58:02 GMT)
Full text and
rfc822 format available.
Message #39 received at 26650 <at> debbugs.gnu.org (full text, mbox):
On Wed, 26 Apr 2017, npostavs <at> users.sourceforge.net wrote:
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>>>>> + (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.
>>
>> Right, sorry for not paying attention.
>
> Maybe I should have written
>
> (add-hook 'kill-buffer-hook (lambda ...) nil 'local)
>
> to emphasize this? I'm still undecided on the general style question of
> whether to use t or '<symbol> in these cases.
This reminds me the discussion here:
https://github.com/bbatsov/emacs-lisp-style-guide/issues/30
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#26650
; Package
emacs
.
(Wed, 26 Apr 2017 15:34:03 GMT)
Full text and
rfc822 format available.
Message #42 received at 26650 <at> debbugs.gnu.org (full text, mbox):
> From: npostavs <at> users.sourceforge.net
> Cc: Tino Calancha <tino.calancha <at> gmail.com>, 26650 <at> debbugs.gnu.org
> Date: Wed, 26 Apr 2017 08:52:26 -0400
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> >> >> + (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.
> >
> > Right, sorry for not paying attention.
>
> Maybe I should have written
>
> (add-hook 'kill-buffer-hook (lambda ...) nil 'local)
>
> to emphasize this?
It's up to you, but the fact that I didn't see it is not a reason good
enough to change anything, IMO.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#26650
; Package
emacs
.
(Wed, 24 May 2017 00:17:02 GMT)
Full text and
rfc822 format available.
Message #45 received at 26650 <at> debbugs.gnu.org (full text, mbox):
tags 26650 fixed
close 26650 26.1
quit
Eli Zaretskii <eliz <at> gnu.org> writes:
>> >> >> + (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.
>> >
>> > Right, sorry for not paying attention.
>>
>> Maybe I should have written
>>
>> (add-hook 'kill-buffer-hook (lambda ...) nil 'local)
>>
>> to emphasize this?
>
> It's up to you, but the fact that I didn't see it is not a reason good
> enough to change anything, IMO.
Coming back to this, I found having the "... nil t)" on the same line as
the lambda confusing to read. So I moved them to the next line; I
didn't change the "t" to "local" [1: ef9f5c672a].
[1: ef9f5c672a]: 2017-05-23 20:11:23 -0400
Protect *Backtrace* from being killed (Bug#26650)
http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=ef9f5c672a8e248dd7bd682101c03feb2e527340
Added tag(s) fixed.
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Wed, 24 May 2017 00:17:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 26.1, send any further explanations to
26650 <at> debbugs.gnu.org and Tino Calancha <tino.calancha <at> gmail.com>
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Wed, 24 May 2017 00:17:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 21 Jun 2017 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 8 years and 1 day ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.