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

From: David Engster <[email-masked]>
Date: Thu, 16 Jun 2011 15:57:24 +0200

martin rudalics writes:
>> BTW, but I think related to this, I don't really understand the new
>> default for pop-up-frames. The doc-string says:
>>
>> "If this is the symbol unset, the option was not set and is
>> ignored."
>
> 'unset stands for "nobody bothered to set or bind this".
>
>> Sorry, but I think this is a bit of a cop-out. You can't really ignore a
>> boolean option - you either pop up a new frame or you don't; it all just
>> depends on how you handle "unset", and this introduces ambiguity in the
>> code. A quick grep shows me that pop-up-frames is either tested with
>>
>> (if (memq pop-up-frames '(nil unset))
>>   ...
>>
>> which means 'unset is actually handled as "not set",
>
> Because it's the same for `display-buffer'.

I see.

>
>> or it is simply
>> tested with
>>
>> (if pop-up-frames
>>   ...
>
> I can't find this anywhere :-(

Sorry, I should have been more explicit: There are places in the Emacs
sources which only test pop-up-frames for being non-nil, usually with
'and'/'or':

calendar/diary-lib.el:

  (let* ((pop-up-frames (or pop-up-frames
                            (window-dedicated-p (selected-window))))

mail/rmail.el:

        (and pop-up-frames (one-window-p))

progmodes/inf-lisp.el:

     (let ((pop-up-frames
             ;; Be willing to use another frame
             ;; that already has the window in it.
             (or pop-up-frames
                 (get-buffer-window inferior-lisp-buffer t))))

vc/pcvs-util.el:

    (let ((pop-up-windows (or pop-up-windows pop-up-frames))

... just to mention a few.

>> which means 'unset is handled as "set".
>
> But an application should be allowed to test whether the user or the
> calling application has set this option in some way or the other before
> possibly (re-)binding it.  If the value is still 'unset, no one bothered
> about it.  If it is nil, someone up there explicitly doesn't want to pop
> up buffers.  If it's graphic-only, someone up there wants to pop them up
> on graphic systems only.  Any other value means that someone wants to
> pop up frames anywhere.  Not that applications care that much ...

OK, I think I understand the motivation behind 'unset now. However, this
effectively means that there really is no default value for
pop-up-frames, and every application can decide how they will deal with
that. The snippets above will see it as non-nil and will now create
frames.

>> I would vote for setting the default to 'graphic-only.
>
> IIRC the default was nil.  'graphic-only was IMHO a not very
> well-conceived idea because it didn't inhibit applications to rebind
> this to t.  I've never seen a `pop-up-frames' rebinding function care
> about this issue.

Right, the current code doesn't care about 'graphic-only, but neither
does the old code care about 'unset. This can be changed, of course... :-)

>> (Maybe this is the wrong place to discuss this - please let me know if I
>> should file another bug-report or bring this to emacs-devel).
>
> Please do what you find more convenient ;-)
>
> BTW, Drew started a related discussion in another thread.  I asked him
> to join us.

I actually don't feel that strongly about it. It just found it
confusing, but I think I understand it better now. I have set this
option to nil anyway. :-)

Thanks for explaining,
David