* bug#26650: 26.0.50; Protect *Backtrace* from accidental killing
@ 2017-04-25 12:02 Tino Calancha
2017-04-25 12:13 ` npostavs
0 siblings, 1 reply; 13+ messages in thread
From: Tino Calancha @ 2017-04-25 12:02 UTC (permalink / raw)
To: 26650
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
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26650: 26.0.50; Protect *Backtrace* from accidental killing
2017-04-25 12:02 bug#26650: 26.0.50; Protect *Backtrace* from accidental killing Tino Calancha
@ 2017-04-25 12:13 ` npostavs
2017-04-25 12:18 ` Tino Calancha
0 siblings, 1 reply; 13+ messages in thread
From: npostavs @ 2017-04-25 12:13 UTC (permalink / raw)
To: Tino Calancha; +Cc: 26650
severity 26650 minor
quit
Tino Calancha <tino.calancha@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.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26650: 26.0.50; Protect *Backtrace* from accidental killing
2017-04-25 12:13 ` npostavs
@ 2017-04-25 12:18 ` Tino Calancha
2017-04-25 12:50 ` npostavs
0 siblings, 1 reply; 13+ messages in thread
From: Tino Calancha @ 2017-04-25 12:18 UTC (permalink / raw)
To: npostavs; +Cc: 26650, Tino Calancha
On Tue, 25 Apr 2017, npostavs@users.sourceforge.net wrote:
> severity 26650 minor
> quit
>
> Tino Calancha <tino.calancha@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.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26650: 26.0.50; Protect *Backtrace* from accidental killing
2017-04-25 12:18 ` Tino Calancha
@ 2017-04-25 12:50 ` npostavs
2017-04-25 13:02 ` Tino Calancha
2017-04-26 10:07 ` Eli Zaretskii
0 siblings, 2 replies; 13+ messages in thread
From: npostavs @ 2017-04-25 12:50 UTC (permalink / raw)
To: Tino Calancha; +Cc: 26650
[-- Attachment #1: Type: text/plain, Size: 689 bytes --]
tags 26650 patch
quit
Tino Calancha <tino.calancha@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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 888 bytes --]
From 9e2f66a300cc0c94fb1369cbf3721d41d98c2d94 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@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))
\f
(defcustom debugger-record-buffer "*Debugger-record*"
--
2.11.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* bug#26650: 26.0.50; Protect *Backtrace* from accidental killing
2017-04-25 12:50 ` npostavs
@ 2017-04-25 13:02 ` Tino Calancha
2017-04-26 10:07 ` Eli Zaretskii
1 sibling, 0 replies; 13+ messages in thread
From: Tino Calancha @ 2017-04-25 13:02 UTC (permalink / raw)
To: npostavs; +Cc: 26650, Tino Calancha
On Tue, 25 Apr 2017, npostavs@users.sourceforge.net wrote:
> tags 26650 patch
> quit
>
> Tino Calancha <tino.calancha@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.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26650: 26.0.50; Protect *Backtrace* from accidental killing
2017-04-25 12:50 ` npostavs
2017-04-25 13:02 ` Tino Calancha
@ 2017-04-26 10:07 ` Eli Zaretskii
2017-04-26 10:36 ` Tino Calancha
2017-04-26 10:49 ` Michael Heerdegen
1 sibling, 2 replies; 13+ messages in thread
From: Eli Zaretskii @ 2017-04-26 10:07 UTC (permalink / raw)
To: npostavs; +Cc: 26650, tino.calancha
> From: npostavs@users.sourceforge.net
> Date: Tue, 25 Apr 2017 08:50:00 -0400
> Cc: 26650@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*?
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26650: 26.0.50; Protect *Backtrace* from accidental killing
2017-04-26 10:07 ` Eli Zaretskii
@ 2017-04-26 10:36 ` Tino Calancha
2017-04-26 11:03 ` Eli Zaretskii
2017-04-26 10:49 ` Michael Heerdegen
1 sibling, 1 reply; 13+ messages in thread
From: Tino Calancha @ 2017-04-26 10:36 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 26650, npostavs, Tino Calancha
On Wed, 26 Apr 2017, Eli Zaretskii wrote:
>> From: npostavs@users.sourceforge.net
>> Date: Tue, 25 Apr 2017 08:50:00 -0400
>> Cc: 26650@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.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26650: 26.0.50; Protect *Backtrace* from accidental killing
2017-04-26 10:07 ` Eli Zaretskii
2017-04-26 10:36 ` Tino Calancha
@ 2017-04-26 10:49 ` Michael Heerdegen
1 sibling, 0 replies; 13+ messages in thread
From: Michael Heerdegen @ 2017-04-26 10:49 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 26650, npostavs, tino.calancha
Eli Zaretskii <eliz@gnu.org> writes:
> > From: npostavs@users.sourceforge.net
> > Date: Tue, 25 Apr 2017 08:50:00 -0400
> > Cc: 26650@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.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26650: 26.0.50; Protect *Backtrace* from accidental killing
2017-04-26 10:36 ` Tino Calancha
@ 2017-04-26 11:03 ` Eli Zaretskii
2017-04-26 12:52 ` npostavs
0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2017-04-26 11:03 UTC (permalink / raw)
To: Tino Calancha; +Cc: 26650, npostavs
> From: Tino Calancha <tino.calancha@gmail.com>
> Date: Wed, 26 Apr 2017 19:36:54 +0900 (JST)
> cc: npostavs@users.sourceforge.net, Tino Calancha <tino.calancha@gmail.com>,
> 26650@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.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26650: 26.0.50; Protect *Backtrace* from accidental killing
2017-04-26 11:03 ` Eli Zaretskii
@ 2017-04-26 12:52 ` npostavs
2017-04-26 13:57 ` Tino Calancha
2017-04-26 15:33 ` Eli Zaretskii
0 siblings, 2 replies; 13+ messages in thread
From: npostavs @ 2017-04-26 12:52 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 26650, Tino Calancha
Eli Zaretskii <eliz@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.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26650: 26.0.50; Protect *Backtrace* from accidental killing
2017-04-26 12:52 ` npostavs
@ 2017-04-26 13:57 ` Tino Calancha
2017-04-26 15:33 ` Eli Zaretskii
1 sibling, 0 replies; 13+ messages in thread
From: Tino Calancha @ 2017-04-26 13:57 UTC (permalink / raw)
To: npostavs; +Cc: 26650, Tino Calancha
On Wed, 26 Apr 2017, npostavs@users.sourceforge.net wrote:
> Eli Zaretskii <eliz@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
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26650: 26.0.50; Protect *Backtrace* from accidental killing
2017-04-26 12:52 ` npostavs
2017-04-26 13:57 ` Tino Calancha
@ 2017-04-26 15:33 ` Eli Zaretskii
2017-05-24 0:18 ` npostavs
1 sibling, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2017-04-26 15:33 UTC (permalink / raw)
To: npostavs; +Cc: 26650, tino.calancha
> From: npostavs@users.sourceforge.net
> Cc: Tino Calancha <tino.calancha@gmail.com>, 26650@debbugs.gnu.org
> Date: Wed, 26 Apr 2017 08:52:26 -0400
>
> Eli Zaretskii <eliz@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.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#26650: 26.0.50; Protect *Backtrace* from accidental killing
2017-04-26 15:33 ` Eli Zaretskii
@ 2017-05-24 0:18 ` npostavs
0 siblings, 0 replies; 13+ messages in thread
From: npostavs @ 2017-05-24 0:18 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 26650, tino.calancha
tags 26650 fixed
close 26650 26.1
quit
Eli Zaretskii <eliz@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
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2017-05-24 0:18 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-25 12:02 bug#26650: 26.0.50; Protect *Backtrace* from accidental killing Tino Calancha
2017-04-25 12:13 ` npostavs
2017-04-25 12:18 ` Tino Calancha
2017-04-25 12:50 ` npostavs
2017-04-25 13:02 ` Tino Calancha
2017-04-26 10:07 ` Eli Zaretskii
2017-04-26 10:36 ` Tino Calancha
2017-04-26 11:03 ` Eli Zaretskii
2017-04-26 12:52 ` npostavs
2017-04-26 13:57 ` Tino Calancha
2017-04-26 15:33 ` Eli Zaretskii
2017-05-24 0:18 ` npostavs
2017-04-26 10:49 ` Michael Heerdegen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.