GNU bug report logs -
#8789
23.3; debug backtrace buffer changes window on step-through
Previous Next
Reported by: Pete Beardmore <pete.beardmore <at> msn.com>
Date: Thu, 2 Jun 2011 17:28:02 UTC
Severity: normal
Found in version 23.3
Done: martin rudalics <rudalics <at> gmx.at>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> Sounds good for the backtrace buffer, but the patch you propose would
> affect many more cases, and while I think it might be good to do it
> globally like you suggest, I wouldn't want to make such a change so late
> in the pretest.
Neither do I. The problem is that if a window is not very suitable for
getting reused, there's no easy way for the user (or the application) to
communicate that to the buffer display routines.
> Can you provide another patch that limits the effect to the
> backtrace buffer?
Can you? I think that using `display-buffer-overriding-action' would be
too harsh so we would have to specify this via the ACTION argument in
(pop-to-buffer debugger-buffer). A patch in that direction is below.
martin
=== modified file 'lisp/emacs-lisp/debug.el'
--- lisp/emacs-lisp/debug.el 2012-01-19 07:21:25 +0000
+++ lisp/emacs-lisp/debug.el 2012-02-16 07:51:35 +0000
@@ -194,7 +194,9 @@
;; Place an extra debug-on-exit for macro's.
(when (eq 'lambda (car-safe (cadr (backtrace-frame 4))))
(backtrace-debug 5 t)))
- (pop-to-buffer debugger-buffer)
+ (pop-to-buffer
+ debugger-buffer
+ '((display-buffer-in-window-previously-showing-it . nil)))
(debugger-mode)
(debugger-setup-buffer debugger-args)
(when noninteractive
=== modified file 'lisp/window.el'
--- lisp/window.el 2012-02-12 05:10:30 +0000
+++ lisp/window.el 2012-02-16 07:54:35 +0000
@@ -4846,6 +4846,22 @@
(and pop-up-windows
(display-buffer-pop-up-window buffer alist))))
+(defun display-buffer-in-window-previously-showing-it (buffer &optional alist)
+ "Display BUFFER in a window previously showing it."
+ (let (best-window second-best-window window)
+ (catch 'best-window
+ (dolist (window (window-list-1 nil 'nomini 'visible))
+ (when (and (assq buffer (window-prev-buffers window))
+ (not (window-dedicated-p window)))
+ (if (eq window (selected-window))
+ (setq second-best-window window)
+ (setq best-window window)
+ (throw 'best-window t)))))
+
+ (when (setq window (or best-window second-best-window))
+ (display-buffer-record-window 'reuse window buffer)
+ (window--display-buffer-2 buffer window display-buffer-mark-dedicated))))
+
(defun display-buffer-use-some-window (buffer alist)
"Display BUFFER in an existing window.
Search for a usable window, set that window to the buffer, and
This bug report was last modified 12 years and 223 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.