From: Chong Yidong Date: Fri, 23 Sep 2011 01:42:40 +0000 (-0400) Subject: * window.el (pop-to-buffer): Ensure right window is selected if we chose another... X-Git-Tag: emacs-pretest-24.0.90~45 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=97adfb975605aa3a56a556fc4bf6a15c8a53792a;p=emacs.git * window.el (pop-to-buffer): Ensure right window is selected if we chose another frame. Otherwise, C-x 5 b might not select the right window if reusing a window on another frame. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cfa2035db91..ceef0b7f9b2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-09-23 Chong Yidong + + * window.el (pop-to-buffer): Ensure right window is selected if we + chose another frame. + 2011-09-22 Eli Zaretskii * simple.el (what-cursor-position): Use get-char-property-change diff --git a/lisp/window.el b/lisp/window.el index fb74c439247..8a72c28f894 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -4853,12 +4853,11 @@ at the front of the list of recently selected ones." (old-frame (selected-frame)) (window (display-buffer buffer action)) (frame (window-frame window))) - (if (eq frame old-frame) - ;; Make sure new window is selected (Bug#8615), (Bug#6954). - (select-window window norecord) - ;; If `display-buffer' has chosen another frame, make sure it - ;; gets input focus. + ;; If we chose another frame, make sure it gets input focus. + (unless (eq frame old-frame) (select-frame-set-input-focus frame norecord)) + ;; Make sure new window is selected (Bug#8615), (Bug#6954). + (select-window window norecord) buffer)) (defun pop-to-buffer-same-window (buffer &optional norecord)