Subject: bug#12502: 24.2.50; Debugger messes up current-buffer

From: martin rudalics <[email-masked]>
Date: Mon, 24 Sep 2012 14:38:01 +0200

> 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
=== 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.