Subject: Re: bug#8857: display-buffer attempt to pop-up frame in batch mode causes "Unknown terminal type" error

From: Glenn Morris <[email-masked]>
Date: Tue, 14 Jun 2011 14:25:52 -0400

martin rudalics wrote:

>> I guess because pop-up-frames defaults to nil in Emacs 23.
>
> Emacs 23 could pop up new frame provided the selected frame isn't
> "usable".

I confess I did not look into precisely what Emacs 23 does, I just saw
that pop-up-frames defaults to nil there. (See below.)

>> But in the trunk, a default Emacs may now pop-up a frame if it thinks it
>> necessary.
>
> I only tried to mimic Emacs 23 here.  So if the original frame cannot be
> used it does try to pop up a new one.  Doesn't Emacs make an invisible
> frame in batch mode?
>
> Maybe the problem happens because I now load window.el _before_
> files.el.  So in Emacs 23 files.el maybe tried to display a buffer but
> failed silently. 

I don't think that can be it.

Here's what the addition of a simple:

(message "%s:%s" buffer-or-name method)

to display-buffer in the trunk shows:

./src/emacs -Q -batch README INSTALL BUGS

INSTALL:reuse-window
INSTALL:pop-up-window
BUGS:reuse-window
BUGS:pop-up-window
BUGS:pop-up-frame
Unknown terminal type

Adding similar stuff to emacs-23, I see that display-buffer's cond tries
the special-display-function branch (no match), the pop-up-windows
branch (no window-to-use), and ends up in the last branch, where it
finds a window-to-use every time. So it never tries to pop-up a frame.