unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: <emacs-pretest-bug@gnu.org>
Subject: RE: display-buffer-other-frame - useful? doc string?
Date: Sat, 5 Apr 2008 17:13:45 -0700	[thread overview]
Message-ID: <000001c8977b$146abc10$0200a8c0@us.oracle.com> (raw)
In-Reply-To: <002401c8820f$7d6042c0$0600a8c0@us.oracle.com>

I thought this had been fixed. CVS shows that the code and doc string are still
problematic. The only thing that was done was to comment out the silly
`lower-frame' and `make-frame(-in)-visible' dance and add a comment saying that
that was harmful and silly. (That at least stopped the frame from being
lowered.)

I sent this code (*twice*), which DTRT. It simply displays the buffer in another
frame. (If it's important, you can add null bindings for `same-window-*' and
return the selected window, as before.)

(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 suggestion was ignored. 

At least on Windows, with the change that was made instead, the command doesn't
just display the buffer in another frame. It also selects the buffer, so it does
the same thing as `switch-to-buffer-other-frame'. Displaying a buffer is not the
same as switching to it. We don't need two different commands with two key
bindings to switch to a buffer in another frame.

On Windows, at least, frame focus changes when you display a buffer the way the
current code does. You need to explicitly set the frame focus back to the
original window, to not have it change. Perhaps there is another way - dunno.

If this command is supposed to do what its name suggests, then it is implemented
wrong, IMO. Do it a different way, if you want, but please do what the command
name says, not something else.

In any case, the doc string is (still) incorrect. The first line is still
identical to that of `switch-to-buffer-other-frame', and it still implies that
the buffer is selected (which it is, on Windows, but which is presumably not the
intention).

Why is it so hard to get such a simple correction made? A 13-mail thread, for
nada. Why just add a complex comment about the old code being brain-dead,
instead of DTRT? One of us is not getting it.

Here is the current definition:

(defun display-buffer-other-frame (buffer)
  "Switch to buffer BUFFER in another frame.
This uses the function `display-buffer' as a subroutine; see its
documentation for additional customization information."
  (interactive "BDisplay buffer in other frame: ")
  (let ((pop-up-frames t)
	  same-window-buffer-names same-window-regexps
        (old-window (selected-window))
	  new-window)
    (setq new-window (display-buffer buffer t))
    ;; This may have been here in order to prevent the new frame from hiding
    ;; the old frame.  But it does more harm than good.
    ;; Maybe we should call `raise-window' on the old-frame instead?  --Stef
    ;;(lower-frame (window-frame new-window))

    ;; This may have been here in order to make sure the old-frame gets the
    ;; focus.  But not only can it cause an annoying flicker, with some
    ;; window-managers it just makes the window invisible, with no easy
    ;; way to recover it.  --Stef
    ;;(make-frame-invisible (window-frame old-window))
    ;;(make-frame-visible (window-frame old-window))
    ))

> From: Drew Adams Sent: Sunday, March 09, 2008 11:01 AM
> 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. 






  parent reply	other threads:[~2008-04-06  0:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-09 18:00 display-buffer-other-frame - useful? doc string? Drew Adams
2008-03-09 21:48 ` Stefan Monnier
2008-03-09 22:06   ` Drew Adams
2008-03-10 17:16     ` Richard Stallman
2008-03-10 17:19       ` Drew Adams
2008-03-10 17:59       ` Stefan Monnier
2008-03-11 20:24         ` Richard Stallman
2008-03-10 17:15   ` Richard Stallman
2008-03-10 17:34   ` Andreas Schwab
2008-03-10 18:01     ` Stefan Monnier
2008-03-10 18:43       ` Andreas Schwab
2008-03-10  6:11 ` Richard Stallman
2008-03-10  6:22   ` Drew Adams
2008-04-06  0:13 ` Drew Adams [this message]
2008-04-06  2:28   ` Stefan Monnier
2008-04-06  7:52     ` Drew Adams
2008-04-07  0:51       ` Stefan Monnier
2008-04-07  1:18         ` Drew Adams
2008-04-07 16:01           ` Stefan Monnier
2008-04-07 16:14             ` Drew Adams
2008-04-07 16:44               ` Lennart Borgman (gmail)
2008-04-07 16:52                 ` Drew Adams
2008-04-07 17:02                   ` Lennart Borgman (gmail)
2008-04-07 17:06                     ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000001c8977b$146abc10$0200a8c0@us.oracle.com' \
    --to=drew.adams@oracle.com \
    --cc=emacs-pretest-bug@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).