unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#12502: 24.2.50; Debugger messes up current-buffer
@ 2012-09-24  8:31 Helmut Eller
  2012-09-24 12:38 ` martin rudalics
  0 siblings, 1 reply; 5+ messages in thread
From: Helmut Eller @ 2012-09-24  8:31 UTC (permalink / raw)
  To: 12502

The debugger now changes the current buffer in the following situation:

1. Create a file foo.el with this code:

(progn
  (require 'cl)
  (defun foo ()
    (with-current-buffer (get-buffer-create "test")
      (let ((b (current-buffer)))
	(debug)
	(assert (eq b (current-buffer)) t))))
  (foo))

2. In the foo.el buffer, evaluate the expression with C-x C-e

3. The debugger pops up with this message:
   Debugger entered: nil

4. Press c (i.e. debugger-continue)

5. The assertion fails with:
  Assertion failed: (eq b (current-buffer)), #<buffer test>, #<buffer foo.el>

This is a regression to older versions.


In GNU Emacs 24.2.50.1 (i686-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2012-09-22 on ix
Bzr revision: 110128 cyd@gnu.org-20120922032937-yf6yua64ed45tzap
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
Configured using:
 `configure '--with-jpeg=no' '--with-gif=no' '--with-tiff=no''






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#12502: 24.2.50; Debugger messes up current-buffer
  2012-09-24  8:31 bug#12502: 24.2.50; Debugger messes up current-buffer Helmut Eller
@ 2012-09-24 12:38 ` martin rudalics
  2012-09-25 15:36   ` Helmut Eller
  0 siblings, 1 reply; 5+ messages in thread
From: martin rudalics @ 2012-09-24 12:38 UTC (permalink / raw)
  To: Helmut Eller; +Cc: 12502

[-- Attachment #1: Type: text/plain, Size: 603 bytes --]

 > The debugger now changes the current buffer in the following situation:
[...]
 > This is a regression to older versions.

Thanks for the report.  Would the attached patch fix it?

BTW, I notice that you quite often run functions with a current buffer
different from that of the selected window.  In all these cases
`quit-window' might misbehave for you because it does not restore the
buffer that was current at the time the window's buffer was displayed.
So if you see any problems in this context, please tell me.  We then
could try to restore the current buffer (optionally at least) too.

martin

[-- Attachment #2: debug-restore-current-buffer.diff --]
[-- Type: text/plain, Size: 678 bytes --]

=== modified file 'lisp/emacs-lisp/debug.el'
--- lisp/emacs-lisp/debug.el	2012-09-20 13:35:13 +0000
+++ lisp/emacs-lisp/debug.el	2012-09-24 12:30:50 +0000
@@ -273,7 +273,8 @@
 	    (setq debugger-previous-window-height
 		  (window-total-size debugger-window))
 	    ;; Unshow debugger-buffer.
-	    (quit-restore-window debugger-window debugger-bury-or-kill))
+	    (quit-restore-window debugger-window debugger-bury-or-kill)
+	    (set-buffer debugger-old-buffer))
           ;; Restore previous state of debugger-buffer in case we were
           ;; in a recursive invocation of the debugger, otherwise just
           ;; erase the buffer and put it into fundamental mode.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#12502: 24.2.50; Debugger messes up current-buffer
  2012-09-24 12:38 ` martin rudalics
@ 2012-09-25 15:36   ` Helmut Eller
  2012-09-25 16:45     ` martin rudalics
  2012-10-03  9:14     ` martin rudalics
  0 siblings, 2 replies; 5+ messages in thread
From: Helmut Eller @ 2012-09-25 15:36 UTC (permalink / raw)
  To: martin rudalics; +Cc: 12502

On Mon, Sep 24 2012, martin rudalics wrote:

>> The debugger now changes the current buffer in the following situation:
> [...]
>> This is a regression to older versions.
>
> Thanks for the report.  Would the attached patch fix it?

Yes, that seems to fix the problem.  But the save-exursion in line 218
looks now supsisously irrelevant.

> BTW, I notice that you quite often run functions with a current buffer
> different from that of the selected window.  In all these cases
> `quit-window' might misbehave for you because it does not restore the
> buffer that was current at the time the window's buffer was displayed.
> So if you see any problems in this context, please tell me.  We then
> could try to restore the current buffer (optionally at least) too.

I'l look for problems, but I'm not sure what the correct/incorrect
behaviour regarding window management should be.  The old
save-window-excursion worked pretty well for me.

Helmut





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#12502: 24.2.50; Debugger messes up current-buffer
  2012-09-25 15:36   ` Helmut Eller
@ 2012-09-25 16:45     ` martin rudalics
  2012-10-03  9:14     ` martin rudalics
  1 sibling, 0 replies; 5+ messages in thread
From: martin rudalics @ 2012-09-25 16:45 UTC (permalink / raw)
  To: Helmut Eller; +Cc: 12502

 > Yes, that seems to fix the problem.  But the save-exursion in line 218
 > looks now supsisously irrelevant.

Maybe.  There's another one nested inside.  I know next to nothing about
the internals of the debugger.

 > I'l look for problems, but I'm not sure what the correct/incorrect
 > behaviour regarding window management should be.  The old
 > save-window-excursion worked pretty well for me.

It didn't work at all for people showing the debugger in an extra frame.

martin





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#12502: 24.2.50; Debugger messes up current-buffer
  2012-09-25 15:36   ` Helmut Eller
  2012-09-25 16:45     ` martin rudalics
@ 2012-10-03  9:14     ` martin rudalics
  1 sibling, 0 replies; 5+ messages in thread
From: martin rudalics @ 2012-10-03  9:14 UTC (permalink / raw)
  To: Helmut Eller; +Cc: 12502-done

 >> Thanks for the report.  Would the attached patch fix it?
 >
 > Yes, that seems to fix the problem.

Installed.  Bug closed.

 > But the save-exursion in line 218
 > looks now supsisously irrelevant.

I left it in because IIUC it can't do any harm.

martin





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-10-03  9:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-24  8:31 bug#12502: 24.2.50; Debugger messes up current-buffer Helmut Eller
2012-09-24 12:38 ` martin rudalics
2012-09-25 15:36   ` Helmut Eller
2012-09-25 16:45     ` martin rudalics
2012-10-03  9:14     ` martin rudalics

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).