comparison lisp/window.el @ 98577:457b5cef3f44

(pop-up-frames): Add choice graphic-only. (display-buffer): When pop-up-frames equals graphic-only do not pop up new frame on text-only terminals. (Bug#1061)
author Martin Rudalics <rudalics@gmx.at>
date Thu, 09 Oct 2008 08:12:01 +0000
parents 93f3b87e5666
children 234a18b5c81e
comparison
equal deleted inserted replaced
98576:5472a993dc3a 98577:457b5cef3f44
708 See also `same-window-buffer-names'." 708 See also `same-window-buffer-names'."
709 :type '(repeat (regexp :format "%v")) 709 :type '(repeat (regexp :format "%v"))
710 :group 'windows) 710 :group 'windows)
711 711
712 (defcustom pop-up-frames nil 712 (defcustom pop-up-frames nil
713 "Non-nil means `display-buffer' should make a separate frame." 713 "Whether `display-buffer' should make a separate frame.
714 :type 'boolean 714 If nil, never make a seperate frame.
715 If the value is `graphic-only', make a separate frame
716 on graphic displays only.
717 Any other non-nil value means always make a separate frame."
718 :type '(choice
719 (const :tag "Never" nil)
720 (const :tag "On graphic displays only" graphic-only)
721 (const :tag "Always" t))
715 :group 'windows) 722 :group 'windows)
716 723
717 (defcustom display-buffer-reuse-frames nil 724 (defcustom display-buffer-reuse-frames nil
718 "Non-nil means `display-buffer' should reuse frames. 725 "Non-nil means `display-buffer' should reuse frames.
719 If the buffer in question is already displayed in a frame, raise 726 If the buffer in question is already displayed in a frame, raise
929 936
930 A specific frame - consider windows on that frame only. 937 A specific frame - consider windows on that frame only.
931 938
932 nil - consider windows on the selected frame \(actually the 939 nil - consider windows on the selected frame \(actually the
933 last non-minibuffer frame\) only. If, however, either 940 last non-minibuffer frame\) only. If, however, either
934 `display-buffer-reuse-frames' or `pop-up-frames' is non-nil, 941 `display-buffer-reuse-frames' or `pop-up-frames' is non-nil
942 \(non-nil and not graphic-only on a text-only terminal),
935 consider all visible or iconified frames." 943 consider all visible or iconified frames."
936 (interactive "BDisplay buffer:\nP") 944 (interactive "BDisplay buffer:\nP")
937 (let* ((can-use-selected-window 945 (let* ((can-use-selected-window
938 ;; The selected window is usable unless either NOT-THIS-WINDOW 946 ;; The selected window is usable unless either NOT-THIS-WINDOW
939 ;; is non-nil, it is dedicated to its buffer, or it is the 947 ;; is non-nil, it is dedicated to its buffer, or it is the
943 (window-minibuffer-p)))) 951 (window-minibuffer-p))))
944 (buffer (if (bufferp buffer-or-name) 952 (buffer (if (bufferp buffer-or-name)
945 buffer-or-name 953 buffer-or-name
946 (get-buffer buffer-or-name))) 954 (get-buffer buffer-or-name)))
947 (name-of-buffer (buffer-name buffer)) 955 (name-of-buffer (buffer-name buffer))
956 ;; On text-only terminals do not pop up a new frame when
957 ;; `pop-up-frames' equals graphic-only.
958 (use-pop-up-frames (if (eq pop-up-frames 'graphic-only)
959 (display-graphic-p)
960 pop-up-frames))
948 ;; `frame-to-use' is the frame where to show `buffer' - either 961 ;; `frame-to-use' is the frame where to show `buffer' - either
949 ;; the selected frame or the last nonminibuffer frame. 962 ;; the selected frame or the last nonminibuffer frame.
950 (frame-to-use 963 (frame-to-use
951 (or (window--frame-usable-p (selected-frame)) 964 (or (window--frame-usable-p (selected-frame))
952 (window--frame-usable-p (last-nonminibuffer-frame)))) 965 (window--frame-usable-p (last-nonminibuffer-frame))))
965 (window--display-buffer-1 (selected-window))) 978 (window--display-buffer-1 (selected-window)))
966 ((and can-use-selected-window (same-window-p name-of-buffer)) 979 ((and can-use-selected-window (same-window-p name-of-buffer))
967 ;; If the buffer's name tells us to use the selected window do so. 980 ;; If the buffer's name tells us to use the selected window do so.
968 (window--display-buffer-2 buffer (selected-window))) 981 (window--display-buffer-2 buffer (selected-window)))
969 ((let ((frames (or frame 982 ((let ((frames (or frame
970 (and (or pop-up-frames display-buffer-reuse-frames 983 (and (or use-pop-up-frames
984 display-buffer-reuse-frames
971 (not (last-nonminibuffer-frame))) 985 (not (last-nonminibuffer-frame)))
972 0) 986 0)
973 (last-nonminibuffer-frame)))) 987 (last-nonminibuffer-frame))))
974 (and (setq window-to-use (get-buffer-window buffer frames)) 988 (and (setq window-to-use (get-buffer-window buffer frames))
975 (or can-use-selected-window 989 (or can-use-selected-window
981 ;; parameters to pass to `special-display-function'. 995 ;; parameters to pass to `special-display-function'.
982 (let ((pars (special-display-p name-of-buffer))) 996 (let ((pars (special-display-p name-of-buffer)))
983 (when pars 997 (when pars
984 (funcall special-display-function 998 (funcall special-display-function
985 buffer (if (listp pars) pars)))))) 999 buffer (if (listp pars) pars))))))
986 ((or pop-up-frames (not frame-to-use)) 1000 ((or use-pop-up-frames (not frame-to-use))
987 ;; We want or need a new frame. 1001 ;; We want or need a new frame.
988 (window--display-buffer-2 1002 (window--display-buffer-2
989 buffer (frame-selected-window (funcall pop-up-frame-function)))) 1003 buffer (frame-selected-window (funcall pop-up-frame-function))))
990 ((and pop-up-windows 1004 ((and pop-up-windows
991 ;; Make a new window. 1005 ;; Make a new window.