Mercurial > hg > xemacs-beta
comparison 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 |
comparison
equal
deleted
inserted
replaced
258:58424f6abf56 | 259:11cf20601dec |
---|---|
899 ;; creation-hook. If that's the case, leave it alone.) | 899 ;; creation-hook. If that's the case, leave it alone.) |
900 ;; | 900 ;; |
901 (if (window-buffer w) | 901 (if (window-buffer w) |
902 (set-window-buffer w buffer)) | 902 (set-window-buffer w buffer)) |
903 fr)) | 903 fr)) |
904 | |
905 (defcustom get-frame-for-buffer-default-to-current nil | |
906 "*When non-nil, `get-frame-for-buffer' will default to the current frame." | |
907 :type 'boolean | |
908 :group 'frames) | |
909 | 904 |
910 (defun get-frame-for-buffer-noselect (buffer | 905 (defun get-frame-for-buffer-noselect (buffer |
911 &optional not-this-window-p on-frame) | 906 &optional not-this-window-p on-frame) |
912 "Return a frame in which to display BUFFER. | 907 "Return a frame in which to display BUFFER. |
913 This is a subroutine of `get-frame-for-buffer' (which see)." | 908 This is a subroutine of `get-frame-for-buffer' (which see)." |
1010 (if (or (eq limit 0) ; means create with reckless abandon | 1005 (if (or (eq limit 0) ; means create with reckless abandon |
1011 (< (length frames) limit)) | 1006 (< (length frames) limit)) |
1012 (get-frame-for-buffer-make-new-frame buffer) | 1007 (get-frame-for-buffer-make-new-frame buffer) |
1013 (car frames)))) | 1008 (car frames)))) |
1014 | 1009 |
1015 ;; | 1010 (not-this-window-p |
1016 ;; This buffer's mode did not express a preference for a frame of a | 1011 (let ((w-list (windows-of-buffer buffer)) |
1017 ;; particular name. However, the user wants the frame to be the | 1012 f w |
1018 ;; current one in that case. | 1013 (first-choice nil) |
1019 ;; | 1014 (second-choice nil) |
1020 (get-frame-for-buffer-default-to-current nil) | 1015 (last-resort nil)) |
1021 | 1016 (while (and w-list (null first-choice)) |
1017 (setq w (car w-list) | |
1018 f (window-frame w)) | |
1019 (cond ((eq w (selected-window)) nil) | |
1020 ((not (frame-visible-p f)) | |
1021 (if (null last-resort) | |
1022 (setq last-resort w))) | |
1023 ((eq f (selected-frame)) | |
1024 (setq first-choice w)) | |
1025 ((null second-choice) | |
1026 (setq second-choice w))) | |
1027 (setq w-list (cdr w-list))) | |
1028 (or first-choice second-choice last-resort))) | |
1022 (t | 1029 (t |
1023 ;; | 1030 ;; |
1024 ;; This buffer's mode did not express a preference for a frame of a | 1031 ;; This buffer's mode did not express a preference for a frame of a |
1025 ;; particular name. So try to find a frame already displaying this | 1032 ;; particular name. So try to find a frame already displaying this |
1026 ;; buffer. | 1033 ;; buffer. |
1027 ;; | 1034 ;; |
1028 (let ((w (or (get-buffer-window buffer 'visible) ; check visible first | 1035 (let ((w (or (get-buffer-window buffer nil) ; check current first |
1036 (get-buffer-window buffer 'visible) ; then visible | |
1029 (get-buffer-window buffer 0)))) ; then iconic | 1037 (get-buffer-window buffer 0)))) ; then iconic |
1030 (cond ((null w) | 1038 (cond ((null w) |
1031 ;; It's not in any window - return nil, meaning no frame has | 1039 ;; It's not in any window - return nil, meaning no frame has |
1032 ;; preference. | 1040 ;; preference. |
1033 nil) | |
1034 ((and not-this-window-p | |
1035 (eq (selected-frame) (window-frame w))) | |
1036 ;; It's in a window, but on this frame, and we have been | |
1037 ;; asked to pick another window. Return nil, meaning no | |
1038 ;; frame has preference. | |
1039 nil) | 1041 nil) |
1040 (t | 1042 (t |
1041 ;; Otherwise, return the frame of the buffer's window. | 1043 ;; Otherwise, return the frame of the buffer's window. |
1042 (window-frame w)))))))) | 1044 (window-frame w)))))))) |
1043 | 1045 |