Subject: Re: bug#12648: 24.2.50; display-buffer switches to another frame

From: martin rudalics <[email-masked]>
Date: Mon, 15 Oct 2012 14:52:44 +0200

>>  >  M-: (display-buffer "foo" nil 'visible) RET
[...]
 >>  > But
 >>  > display-buffer is not supposed to select the window where it displays
 >>  > the buffer.
 >>
 >> Unless it appears on another frame.
 >
 > Isn't that difference confusing?

I think so.

 >> If with emacs -Q you do
 >>
 >> (let ((pop-up-frames t))
 >>    (display-buffer (get-buffer-create "baz")))
 >>
 >> that buffer is shown on a new frame and its window is selected.
 >
 > I think this is different: setting pop-up-frames non-nil expresses a
 > wish to see certain behavior that the default shouldn't have.

Well, if you call `display-buffer' with the FRAME argument 'visible
you're explicitly asking for such behavior.

 >> Maybe we should provide an alist entry like select-frame for this.  If
 >> the buffer already appears in another frame, we would select the frame
 >> only if the entry is set.  If a new frame is created, we could try to
 >> not select it if the entry is not set and the window manager supports
 >> creating a frame and not selecting it.
 >
 > Yes, but is the current behavior useful as it is?

We have a choice between Scylla and Charybdis.  People complained that
making a new frame select the window and reusing an existing frame not
select the window would break their typing habits ...

 > If gud.el should call display-buffer in some different way to avoid
 > selecting the frame with the source, that, too, could be a good
 > solution.

IIUC that's what Chong's `inhibit-switch-frame' alist entry is meant
for.  I haven't tried it yet, though.

martin