Subject: bug#8865: 24.0.50; `display-buffer' does not respect `pop-up-frames'

From: martin rudalics <[email-masked]>
Date: Thu, 16 Jun 2011 17:08:27 +0200

> How about looking at the Emacs sources before you made your changes? ;-)  If you
 > grep the Emacs 20, 21, 22, or 23 Lisp source code for `pop-up-frames' you will
 > see lots of hits, some of which are tests of its value.  For example (Emacs
 > 23.3):
 >
 >>From help.el:
 > (cond ((or pop-up-frames...)...)
 > ...

All these tests will be removed/replaced in due time because these
variables are obsolete now.

 > I use such tests in only a couple of places.  They are of course based on the
 > (original) meaning of `pop-up-frames': non-nil means `display-buffer' uses a
 > separate frame.

And that was incorrect already in Emacs 23.  The value 'graphic-only
should have been dealt with separately.

 > Nothing special.
 >
 > So the question is how to test that user intention using the latest Emacs
 > design.  From my code:
 >
 > ;; If non-nil `pop-up-frames' then inhibit showing annotation.
 > (let ((bookmark-automatically-show-annotations
 >        (and bookmark-automatically-show-annotations
 >             (not pop-up-frames))))
 >
 > ;; Use separate frames instead of windows if `pop-up-frames'
 > ;; is non-nil or if prefix arg is negative.
 > (cond (...)
 >       ((or pop-up-frames option)
 >        (while file-list (find-file-other-frame...

Code shouldn't try to guess the user's intentions in the first place:
The strategy, in increasing priority, is

- users express their intentions in `display-buffer-alist',

- the code can suggest a better solution by passing a second argument to
   the buffer display function,

- users can override the code by setting the override specifier in
   `display-buffer-alist'.

Code should only express suggestions in the sense that "displaying the
buffer in this or that way is best to my knowledge".  The user can
accept that suggestion or override it.  In most cases, however, code
should not suggest anything and leave the decision to the user.

Obviously, if your code is targeted only at users not customizing
`display-buffer-alist', you can test `pop-up-frames' as before, taking
care of the special values 'unset (which means the user doesn't bother)
and 'graphic-only.  One benefit of this is that if `pop-up-frames' is
nil, the user has explicitly delared that she doesn't want to pop up new
frames with your code.

martin