comparison lisp/frame.el @ 263:727739f917cb r20-5b30

Import from CVS: tag r20-5b30
author cvs
date Mon, 13 Aug 2007 10:24:41 +0200
parents 11cf20601dec
children 966663fcf606
comparison
equal deleted inserted replaced
262:9d8607af9e13 263:727739f917cb
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)
904 909
905 (defun get-frame-for-buffer-noselect (buffer 910 (defun get-frame-for-buffer-noselect (buffer
906 &optional not-this-window-p on-frame) 911 &optional not-this-window-p on-frame)
907 "Return a frame in which to display BUFFER. 912 "Return a frame in which to display BUFFER.
908 This is a subroutine of `get-frame-for-buffer' (which see)." 913 This is a subroutine of `get-frame-for-buffer' (which see)."
1009 1014
1010 (not-this-window-p 1015 (not-this-window-p
1011 (let ((w-list (windows-of-buffer buffer)) 1016 (let ((w-list (windows-of-buffer buffer))
1012 f w 1017 f w
1013 (first-choice nil) 1018 (first-choice nil)
1014 (second-choice nil) 1019 (second-choice (if get-frame-for-buffer-default-to-current
1020 (selected-frame)
1021 nil))
1015 (last-resort nil)) 1022 (last-resort nil))
1016 (while (and w-list (null first-choice)) 1023 (while (and w-list (null first-choice))
1017 (setq w (car w-list) 1024 (setq w (car w-list)
1018 f (window-frame w)) 1025 f (window-frame w))
1019 (cond ((eq w (selected-window)) nil) 1026 (cond ((eq w (selected-window)) nil)
1020 ((not (frame-visible-p f)) 1027 ((not (frame-visible-p f))
1021 (if (null last-resort) 1028 (if (null last-resort)
1022 (setq last-resort w))) 1029 (setq last-resort f)))
1023 ((eq f (selected-frame)) 1030 ((eq f (selected-frame))
1024 (setq first-choice w)) 1031 (setq first-choice f))
1025 ((null second-choice) 1032 ((null second-choice)
1026 (setq second-choice w))) 1033 (setq second-choice f)))
1027 (setq w-list (cdr w-list))) 1034 (setq w-list (cdr w-list)))
1028 (or first-choice second-choice last-resort))) 1035 (or first-choice second-choice last-resort)))
1036
1037 (get-frame-for-buffer-default-to-current (selected-frame))
1038
1029 (t 1039 (t
1030 ;; 1040 ;;
1031 ;; This buffer's mode did not express a preference for a frame of a 1041 ;; This buffer's mode did not express a preference for a frame of a
1032 ;; particular name. So try to find a frame already displaying this 1042 ;; particular name. So try to find a frame already displaying this
1033 ;; buffer. 1043 ;; buffer.