[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#8789: 23.3; debug backtrace buffer changes window on step-through
From: |
martin rudalics |
Subject: |
bug#8789: 23.3; debug backtrace buffer changes window on step-through |
Date: |
Thu, 16 Feb 2012 09:03:15 +0100 |
> 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
- bug#8789: 23.3; debug backtrace buffer changes window on step-through, Michael Heerdegen, 2012/02/09
- bug#8789: 23.3; debug backtrace buffer changes window on step-through, Stefan Monnier, 2012/02/09
- bug#8789: 23.3; debug backtrace buffer changes window on step-through, Michael Heerdegen, 2012/02/10
- bug#8789: 23.3; debug backtrace buffer changes window on step-through, martin rudalics, 2012/02/15
- bug#8789: 23.3; debug backtrace buffer changes window on step-through, Stefan Monnier, 2012/02/15
- bug#8789: 23.3; debug backtrace buffer changes window on step-through,
martin rudalics <=
- bug#8789: 23.3; debug backtrace buffer changes window on step-through, Stefan Monnier, 2012/02/16
- bug#8789: 23.3; debug backtrace buffer changes window on step-through, martin rudalics, 2012/02/16
- bug#8789: 23.3; debug backtrace buffer changes window on step-through, Michael Heerdegen, 2012/02/16
- bug#8789: 23.3; debug backtrace buffer changes window on step-through, martin rudalics, 2012/02/17
- bug#8789: 23.3; debug backtrace buffer changes window on step-through, martin rudalics, 2012/02/24
- bug#8789: 23.3; debug backtrace buffer changes window on step-through, Michael Heerdegen, 2012/02/28
- bug#8789: 23.3; debug backtrace buffer changes window on step-through, martin rudalics, 2012/02/29
bug#8789: 23.3; debug backtrace buffer changes window on step-through, martin rudalics, 2012/02/09