Mercurial > hg > xemacs-beta
diff lisp/frame.el @ 259:11cf20601dec r20-5b28
Import from CVS: tag r20-5b28
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:23:02 +0200 |
parents | 51092a27c943 |
children | 727739f917cb |
line wrap: on
line diff
--- a/lisp/frame.el Mon Aug 13 10:22:10 2007 +0200 +++ b/lisp/frame.el Mon Aug 13 10:23:02 2007 +0200 @@ -902,11 +902,6 @@ (set-window-buffer w buffer)) fr)) -(defcustom get-frame-for-buffer-default-to-current nil - "*When non-nil, `get-frame-for-buffer' will default to the current frame." - :type 'boolean - :group 'frames) - (defun get-frame-for-buffer-noselect (buffer &optional not-this-window-p on-frame) "Return a frame in which to display BUFFER. @@ -1012,31 +1007,38 @@ (get-frame-for-buffer-make-new-frame buffer) (car frames)))) - ;; - ;; This buffer's mode did not express a preference for a frame of a - ;; particular name. However, the user wants the frame to be the - ;; current one in that case. - ;; - (get-frame-for-buffer-default-to-current nil) - + (not-this-window-p + (let ((w-list (windows-of-buffer buffer)) + f w + (first-choice nil) + (second-choice nil) + (last-resort nil)) + (while (and w-list (null first-choice)) + (setq w (car w-list) + f (window-frame w)) + (cond ((eq w (selected-window)) nil) + ((not (frame-visible-p f)) + (if (null last-resort) + (setq last-resort w))) + ((eq f (selected-frame)) + (setq first-choice w)) + ((null second-choice) + (setq second-choice w))) + (setq w-list (cdr w-list))) + (or first-choice second-choice last-resort))) (t ;; ;; This buffer's mode did not express a preference for a frame of a ;; particular name. So try to find a frame already displaying this ;; buffer. ;; - (let ((w (or (get-buffer-window buffer 'visible) ; check visible first + (let ((w (or (get-buffer-window buffer nil) ; check current first + (get-buffer-window buffer 'visible) ; then visible (get-buffer-window buffer 0)))) ; then iconic (cond ((null w) ;; It's not in any window - return nil, meaning no frame has ;; preference. nil) - ((and not-this-window-p - (eq (selected-frame) (window-frame w))) - ;; It's in a window, but on this frame, and we have been - ;; asked to pick another window. Return nil, meaning no - ;; frame has preference. - nil) (t ;; Otherwise, return the frame of the buffer's window. (window-frame w))))))))