aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2011-06-21 10:29:43 +0200
committerMartin Rudalics2011-06-21 10:29:43 +0200
commit327c8fb10ae31b2733e94333e04d1a30fcc2c0f2 (patch)
treee1fcbdb9634b3a06a5a176809ad2b7a5c6bff83c
parent7cf3f55609dbddcf420f789ece79b190a0ed35a8 (diff)
downloademacs-327c8fb10ae31b2733e94333e04d1a30fcc2c0f2.tar.gz
emacs-327c8fb10ae31b2733e94333e04d1a30fcc2c0f2.zip
Handle old buffer display options more faithfully.
* window.el (display-buffer-alist): In default value do not enforce searching a window on any but the selected frame. Reported by Katsumi Yamaoka <yamaoka@jpl.org>. (display-buffer-select-window): Remove function. (display-buffer-in-window): When a window on another frame gets reused, do not select it any more but just raise its frame if necessary (Bug#8851) and (Bug#8856). (display-buffer-normalize-options): Handle pop-up-frames related options more faithfully. (pop-to-buffer): Don't rely on `display-buffer' selecting the window if it is on another frame.
-rw-r--r--lisp/ChangeLog22
-rw-r--r--lisp/window.el113
2 files changed, 75 insertions, 60 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 90f67e4e12d..0ab00336fe5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,17 @@
12011-06-21 Martin Rudalics <rudalics@gmx.at>
2
3 * window.el (display-buffer-alist): In default value do not
4 enforce searching a window on any but the selected frame.
5 Reported by Katsumi Yamaoka <yamaoka@jpl.org>.
6 (display-buffer-select-window): Remove function.
7 (display-buffer-in-window): When a window on another frame gets
8 reused, do not select it any more but just raise its frame if
9 necessary (Bug#8851) and (Bug#8856).
10 (display-buffer-normalize-options): Handle pop-up-frames related
11 options more faithfully.
12 (pop-to-buffer): Don't rely on `display-buffer' selecting the
13 window if it is on another frame.
14
12011-06-21 Vincent Belaïche <vincent.b.1@hotmail.fr> 152011-06-21 Vincent Belaïche <vincent.b.1@hotmail.fr>
2 16
3 * play/5x5.el (5x5-solve-rotate-left, 5x5-solve-rotate-right): 17 * play/5x5.el (5x5-solve-rotate-left, 5x5-solve-rotate-right):
@@ -75,14 +89,6 @@
75 89
76 * net/rcirc.el: Delete trailing whitespaces once and for all. 90 * net/rcirc.el: Delete trailing whitespaces once and for all.
77 91
782011-06-20 Martin Rudalics <rudalics@gmx.at>
79
80 * window.el (get-window-with-predicate): Start scanning with
81 window following selected window to restore Emacs 23 behavior.
82 Clarify doc-string.
83 (get-buffer-window-list): Start scanning with selected window to
84 restore Emacs 23 behavior. Clarify doc-string.
85
862011-06-20 Daniel Colascione <dan.colascione@gmail.com> 922011-06-20 Daniel Colascione <dan.colascione@gmail.com>
87 93
88 * emacs-lisp/syntax.el (syntax-ppss): Further improve docstring. 94 * emacs-lisp/syntax.el (syntax-ppss): Further improve docstring.
diff --git a/lisp/window.el b/lisp/window.el
index e222cb04eef..605370aa176 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -3862,8 +3862,8 @@ buffer display specifiers.")
3862 3862
3863(defcustom display-buffer-alist 3863(defcustom display-buffer-alist
3864 '((((regexp . ".*")) 3864 '((((regexp . ".*"))
3865 ;; Reuse window showing same buffer. 3865 ;; Reuse window showing same buffer on same frame.
3866 reuse-window (reuse-window nil same visible) 3866 reuse-window (reuse-window nil same nil)
3867 ;; Pop up window. 3867 ;; Pop up window.
3868 pop-up-window 3868 pop-up-window
3869 ;; Split largest or lru window. 3869 ;; Split largest or lru window.
@@ -4723,22 +4723,6 @@ documentation of `display-buffer-alist' for a description."
4723 ((functionp set-width) 4723 ((functionp set-width)
4724 (ignore-errors (funcall set-width window)))))) 4724 (ignore-errors (funcall set-width window))))))
4725 4725
4726;; We have to work around the deficiency that the command loop does not
4727;; preserve the selected window when it is on a frame that hasn't been
4728;; raised or given input focus. So we have to (1) select the window
4729;; used for displaying a buffer and (2) raise its frame if necessary,
4730;; thus defeating one primary principle of `display-buffer' namely to
4731;; _not_ select the window chosen for displaying the buffer :-(
4732(defun display-buffer-select-window (window &optional norecord)
4733 "Select WINDOW and raise its frame if necessary."
4734 (let ((old-frame (selected-frame))
4735 (new-frame (window-frame window)))
4736 ;; Select WINDOW _before_ raising the frame to assure that the mouse
4737 ;; cursor moves into the correct window.
4738 (select-window window norecord)
4739 (unless (eq old-frame new-frame)
4740 (select-frame-set-input-focus new-frame))))
4741
4742(defun display-buffer-in-window (buffer window specifiers) 4726(defun display-buffer-in-window (buffer window specifiers)
4743 "Display BUFFER in WINDOW and raise its frame if needed. 4727 "Display BUFFER in WINDOW and raise its frame if needed.
4744WINDOW must be a live window and defaults to the selected one. 4728WINDOW must be a live window and defaults to the selected one.
@@ -4759,8 +4743,16 @@ documentation of `display-buffer-alist' for a description."
4759 (set-window-dedicated-p window dedicated)) 4743 (set-window-dedicated-p window dedicated))
4760 (when no-other-window 4744 (when no-other-window
4761 (set-window-parameter window 'no-other-window t)) 4745 (set-window-parameter window 'no-other-window t))
4762 (unless (eq old-frame new-frame) 4746 (unless (or (eq old-frame new-frame)
4763 (display-buffer-select-window window)) 4747 (not (frame-visible-p new-frame))
4748 ;; Assume the selected frame is already visible enough.
4749 (eq new-frame (selected-frame))
4750 ;; Assume the frame from which we invoked the minibuffer
4751 ;; is visible.
4752 (and (minibuffer-window-active-p (selected-window))
4753 (eq new-frame
4754 (window-frame (minibuffer-selected-window)))))
4755 (raise-frame new-frame))
4764 ;; Return window. 4756 ;; Return window.
4765 window)) 4757 window))
4766 4758
@@ -5357,11 +5349,14 @@ other-frame for other-windo."
5357BUFFER-OR-NAME is the buffer to display. This routine provides a 5349BUFFER-OR-NAME is the buffer to display. This routine provides a
5358compatibility layer for the now obsolete Emacs 23 buffer display 5350compatibility layer for the now obsolete Emacs 23 buffer display
5359options." 5351options."
5360 (let* ((buffer (normalize-live-buffer buffer-or-name)) 5352 (with-no-warnings
5361 (buffer-name (buffer-name buffer)) 5353 (let* ((buffer (normalize-live-buffer buffer-or-name))
5362 specifiers) 5354 (buffer-name (buffer-name buffer))
5363 ;; Disable warnings, there are too many obsolete options here. 5355 (use-pop-up-frames
5364 (with-no-warnings 5356 (or (and (eq pop-up-frames 'graphic-only)
5357 (display-graphic-p))
5358 pop-up-frames))
5359 specifiers)
5365 ;; `even-window-heights', unless nil or unset. 5360 ;; `even-window-heights', unless nil or unset.
5366 (unless (memq even-window-heights '(nil unset)) 5361 (unless (memq even-window-heights '(nil unset))
5367 (setq specifiers 5362 (setq specifiers
@@ -5408,10 +5403,8 @@ options."
5408 (cons 'largest fun) (cons 'lru fun)) 5403 (cons 'largest fun) (cons 'lru fun))
5409 specifiers)))) 5404 specifiers))))
5410 5405
5411 ;; `pop-up-frame' group. Add things if `pop-up-frames' is non-nil 5406 ;; `pop-up-frame' group.
5412 ;; (we ignore the problem that callers usually don't care about 5407 (when use-pop-up-frames
5413 ;; graphic-only).
5414 (when pop-up-frames
5415 ;; `pop-up-frame-function'. If `pop-up-frame-function' uses the 5408 ;; `pop-up-frame-function'. If `pop-up-frame-function' uses the
5416 ;; now obsolete `pop-up-frame-alist' it will continue to do so. 5409 ;; now obsolete `pop-up-frame-alist' it will continue to do so.
5417 (setq specifiers 5410 (setq specifiers
@@ -5419,7 +5412,16 @@ options."
5419 specifiers)) 5412 specifiers))
5420 ;; `pop-up-frame' 5413 ;; `pop-up-frame'
5421 (setq specifiers 5414 (setq specifiers
5422 (cons (list 'pop-up-frame pop-up-frames) specifiers))) 5415 (cons (list 'pop-up-frame t) specifiers)))
5416
5417 ;; `pop-up-windows' and `use-pop-up-frames' both nil means means
5418 ;; we are supposed to reuse any window on the same frame (unless
5419 ;; we find one showing the same buffer already).
5420 (unless (or pop-up-windows use-pop-up-frames)
5421 ;; `reuse-window' showing any buffer on same frame.
5422 (setq specifiers
5423 (cons (list 'reuse-window nil nil nil)
5424 specifiers)))
5423 5425
5424 ;; `special-display-p' group. 5426 ;; `special-display-p' group.
5425 (when special-display-function 5427 (when special-display-function
@@ -5432,6 +5434,19 @@ options."
5432 (when (listp pars) pars)) 5434 (when (listp pars) pars))
5433 specifiers))))) 5435 specifiers)))))
5434 5436
5437 ;; `pop-up-frames', `display-buffer-reuse-frames', and
5438 ;; `last-nonminibuffer-frame' set means search for a window shoing
5439 ;; the same buffer of another frame.
5440 (let ((frames (or (last-nonminibuffer-frame)
5441 (and (or use-pop-up-frames
5442 display-buffer-reuse-frames)
5443 ;; All visible or iconfied frames.
5444 0))))
5445 (when frames
5446 (setq specifiers
5447 (cons (list 'reuse-window 'other 'same frames)
5448 specifiers))))
5449
5435 ;; `same-window-p' group. 5450 ;; `same-window-p' group.
5436 (when (same-window-p buffer-name) 5451 (when (same-window-p buffer-name)
5437 ;; Try to reuse the same (selected) window. 5452 ;; Try to reuse the same (selected) window.
@@ -5439,25 +5454,9 @@ options."
5439 (cons (list 'reuse-window 'same nil nil) 5454 (cons (list 'reuse-window 'same nil nil)
5440 specifiers))) 5455 specifiers)))
5441 5456
5442 ;; `pop-up-windows' and `pop-up-frames' both nil means means we
5443 ;; are supposed to reuse any window (unless we find one showing
5444 ;; the same buffer already).
5445 (unless (or pop-up-windows pop-up-frames)
5446 ;; `reuse-window' showing any buffer on same frame.
5447 (setq specifiers
5448 (cons (list 'reuse-window nil nil nil)
5449 specifiers)))
5450
5451 ;; `display-buffer-reuse-frames' or `pop-up-frames' non-nil means
5452 ;; we are supposed to reuse a window showing the same buffer on
5453 ;; another frame.
5454 (when (or display-buffer-reuse-frames pop-up-frames)
5455 ;; `reuse-window' showing same buffer on visible frame.
5456 (setq specifiers
5457 (cons (list 'reuse-window nil 'same 0) specifiers)))
5458
5459 ;; Prepend "reuse window on same frame if showing the buffer 5457 ;; Prepend "reuse window on same frame if showing the buffer
5460 ;; already" specifier. 5458 ;; already" specifier. It will be overriden by the application
5459 ;; supplied 'other-window specifier.
5461 (setq specifiers (cons (list 'reuse-window nil 'same nil) 5460 (setq specifiers (cons (list 'reuse-window nil 'same nil)
5462 specifiers)) 5461 specifiers))
5463 5462
@@ -5761,11 +5760,21 @@ documentations of `display-buffer' and `display-buffer-alist' for
5761additional information." 5760additional information."
5762 (interactive "BPop to buffer:\nP") 5761 (interactive "BPop to buffer:\nP")
5763 (let ((buffer (normalize-buffer-to-display buffer-or-name)) 5762 (let ((buffer (normalize-buffer-to-display buffer-or-name))
5764 window) 5763 (old-window (selected-window))
5764 (old-frame (selected-frame))
5765 new-window new-frame)
5765 (set-buffer buffer) 5766 (set-buffer buffer)
5766 (when (setq window (display-buffer buffer specifiers label)) 5767 (setq new-window (display-buffer buffer specifiers label))
5767 (select-window window norecord) 5768 (unless (eq new-window old-window)
5768 buffer))) 5769 ;; `display-buffer' has chosen another window, select it.
5770 (select-window new-window norecord)
5771 (setq new-frame (window-frame new-window))
5772 (unless (eq new-frame old-frame)
5773 ;; `display-buffer' has chosen another frame, make sure it gets
5774 ;; input focus and is risen.
5775 (select-frame-set-input-focus new-frame)))
5776
5777 buffer))
5769 5778
5770(defsubst pop-to-buffer-same-window (&optional buffer-or-name norecord label) 5779(defsubst pop-to-buffer-same-window (&optional buffer-or-name norecord label)
5771 "Pop to buffer specified by BUFFER-OR-NAME in the selected window. 5780 "Pop to buffer specified by BUFFER-OR-NAME in the selected window.