emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: display-buffer-other-frame - useful? doc string?


From: Drew Adams
Subject: RE: display-buffer-other-frame - useful? doc string?
Date: Sun, 9 Mar 2008 14:06:06 -0800

> > Is the command `display-buffer-other-frame' useful as it is 
> > currently designed? It displays a buffer in another frame, but
> > it also lowers that frame among all window-manager windows.
> > Even if the buffer was already displayed in another frame,
> > that frame is still lowered behind all others.
>  
> > That hardly seems like TRT. If you ask to display a buffer, 
> > you don't want it to be buried out of sight behind all other
> > window-manager windows.
>  
> > Aside from the question of its usefulness, I wonder about its doc
> > string. The first line of the doc string is identical to the first
> > line of the doc string of `switch-to-buffer-other-frame': "Switch to
> > buffer BUFFER in another frame." 
>  
> > But `display-buffer-other-frame' does *not* switch to the buffer (it
> > does not select it); it simply displays it (in a not-very-visible
> > fashion). Contrast that with the doc string of `display-buffer',
> > whose first line explicitly says that the buffer is not selected:
> > "Make BUFFER appear in some window but don't select it."
>  
> > Command `display-buffer-other-frame' is not documented in 
> > any manual - perhaps for good reason. It seems half-baked, to me.
>  
> It indeed looks very odd and the code has no comment to 
> explain/justify the funny dance it does.  My guess is that the
> call to `lower-frame' is to make sure the new frame doesn't hide
> the current one.  And the calls to make-frame-(in)visible may be
> used to try and convince the window
> manager to give focus to the original frame.
> 
> AFAICT it's only used interactively via the C-x 5 C-o binding (which
> I didn't know until right now), so we should be able to change its
> behavior without breaking any elisp code.
> 
> The intention of this function seems to be (compared to C-x 5 b) that
> the focus should stay in the original frame rather than go to the
> new frame.  Of course, focus between frames is something very 
> difficult for Emacs to control, especially when one of the frame is
> being created.

I agree with everything you said. However, I don't see that such a command
would be very useful. Maybe the best thing to do is to remove it altogether

> So please to try and fix the code as best as you can, and then we can
> try and ask around if your patch doesn't make things worse in
> other environments.

Well, here's all I would do, if I wanted such a command:

(defun display-buffer-other-frame (buffer)
  "Show BUFFER in another frame, but don't select it.
See documentation of `display-buffer' for more information."
  (interactive "BDisplay buffer in other frame: ")
  (let ((win (selected-window)))
    (switch-to-buffer-other-frame buffer)
    (select-window win)
    (select-frame-set-input-focus (window-frame win))))

That seems to DTRT. Do you really need a patch for that? Try it first, and
see if that's what you want.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]