Subject: bug#1061: pop-up-frames does not work on a tty

From: Chong Yidong <[email-masked]>
Date: Wed, 08 Oct 2008 20:51:31 -0400

It may not be wise to change the behavior of pop-up-frames so radically
right now.  How bout the following change, which allows a
`on-graphic-displays' value of pop-up-frames to restrict pop-up-frames
to graphic displays?

Martin's patch can go on top of this, for those people who do want to
use pop-up-frames on ttys (who knows, frame manipulation on ttys might
improve in the future).

diff -c /home/cyd/trunk/lisp/window.el.\~1.154.\~ /home/cyd/trunk/lisp/window.el
*** trunk/lisp/window.el.~1.154.~	2008-10-05 14:13:01.000000000 -0400
--- trunk/lisp/window.el	2008-10-08 20:46:19.000000000 -0400
***************
*** 710,717 ****
    :group 'windows)
  
  (defcustom pop-up-frames nil
!   "Non-nil means `display-buffer' should make a separate frame."
!   :type 'boolean
    :group 'windows)
  
  (defcustom display-buffer-reuse-frames nil
--- 710,723 ----
    :group 'windows)
  
  (defcustom pop-up-frames nil
!   "Whether `display-buffer' should make a separate frame.
! If nil, never make a seperate frame.
! If the value is `on-graphic-displays', make a separate frame only
! if the selected frame is on a graphic display.
! Any other non-nil value means to make a separate frame."
!   :type '(choice (const :tag "Never" nil)
! 		 (const :tag "On graphic displays" on-graphic-displays)
! 		 (const :tag "Always" t))
    :group 'windows)
  
  (defcustom display-buffer-reuse-frames nil
***************
*** 941,946 ****
--- 947,957 ----
  	  (not (or not-this-window
  		   (window-dedicated-p (selected-window))
  		   (window-minibuffer-p))))
+ 	 (use-pop-up-frame
+ 	  (cond ((null pop-up-frames) nil)
+ 		((eq pop-up-frames 'on-graphic-displays)
+ 		 (display-graphic-p))
+ 		(t t)))
  	 (buffer (if (bufferp buffer-or-name)
  		     buffer-or-name
  		   (get-buffer buffer-or-name)))
***************
*** 967,973 ****
        ;; If the buffer's name tells us to use the selected window do so.
        (window--display-buffer-2 buffer (selected-window)))
       ((let ((frames (or frame
! 			(and (or pop-up-frames display-buffer-reuse-frames
  				 (not (last-nonminibuffer-frame)))
  			     0)
  			(last-nonminibuffer-frame))))
--- 978,985 ----
        ;; If the buffer's name tells us to use the selected window do so.
        (window--display-buffer-2 buffer (selected-window)))
       ((let ((frames (or frame
! 			(and (or use-pop-up-frame
! 				 display-buffer-reuse-frames
  				 (not (last-nonminibuffer-frame)))
  			     0)
  			(last-nonminibuffer-frame))))
***************
*** 983,989 ****
  	     (when pars
  	       (funcall special-display-function
  			buffer (if (listp pars) pars))))))
!      ((or pop-up-frames (not frame-to-use))
        ;; We want or need a new frame.
        (window--display-buffer-2
         buffer (frame-selected-window (funcall pop-up-frame-function))))
--- 995,1001 ----
  	     (when pars
  	       (funcall special-display-function
  			buffer (if (listp pars) pars))))))
!      ((or use-pop-up-frame (not frame-to-use))
        ;; We want or need a new frame.
        (window--display-buffer-2
         buffer (frame-selected-window (funcall pop-up-frame-function))))

Diff finished.  Wed Oct  8 20:46:21 2008