From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.bugs Subject: bug#745: pop-to-buffer, frames, and input focus Date: Wed, 20 Aug 2008 20:42:48 +0200 Message-ID: References: <48AC2F4A.1000507@gmx.at> Reply-To: Helmut Eller , 745@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1219259275 19745 80.91.229.12 (20 Aug 2008 19:07:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 20 Aug 2008 19:07:55 +0000 (UTC) Cc: 745@emacsbugs.donarmstrong.com To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 20 21:08:47 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KVt2v-00075g-B3 for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Aug 2008 21:08:41 +0200 Original-Received: from localhost ([127.0.0.1]:43461 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KVt1x-0001gZ-OZ for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Aug 2008 15:07:41 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KVt1m-0001bp-AD for bug-gnu-emacs@gnu.org; Wed, 20 Aug 2008 15:07:30 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KVt1l-0001bL-N4 for bug-gnu-emacs@gnu.org; Wed, 20 Aug 2008 15:07:29 -0400 Original-Received: from [199.232.76.173] (port=34734 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KVt1l-0001bF-CW for bug-gnu-emacs@gnu.org; Wed, 20 Aug 2008 15:07:29 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:46742) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KVt1l-00037b-75 for bug-gnu-emacs@gnu.org; Wed, 20 Aug 2008 15:07:29 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m7KJ7RMC007131; Wed, 20 Aug 2008 12:07:27 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m7KIo3Tl000544; Wed, 20 Aug 2008 11:50:03 -0700 X-Loop: don@donarmstrong.com Resent-From: Helmut Eller Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Wed, 20 Aug 2008 18:50:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 745 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 745-submit@emacsbugs.donarmstrong.com id=B745.121925769631149 (code B ref 745); Wed, 20 Aug 2008 18:50:03 +0000 Original-Received: (at 745) by emacsbugs.donarmstrong.com; 20 Aug 2008 18:41:36 +0000 Original-Received: from rolmail.net (cgp1.rolmail.net [195.254.252.190]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m7KIfThN031143 for <745@emacsbugs.donarmstrong.com>; Wed, 20 Aug 2008 11:41:31 -0700 Original-Received: from dummy.name; Wed, 20 Aug 2008 20:41:27 +0200 Original-Received: from dummy.name; Wed, 20 Aug 2008 20:42:49 +0200 In-Reply-To: <48AC2F4A.1000507@gmx.at> (martin rudalics's message of "Wed, 20 Aug 2008 16:50:50 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Resent-Date: Wed, 20 Aug 2008 15:07:29 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:19572 Archived-At: * martin rudalics [2008-08-20 16:50+0200] writes: >> Pops up two frames, one frame displays the "foo" buffer and the other >> the "*scratch*" buffer (so far so good). But the "foo" frame has not >> the input focus. Isn't pop-to-buffer supposed to switch input focus >> too? > > (select-frame-set-input-focus frame)) > > gives input focus to the previously selected frame. Are you saying, that pop-to-buffer can't be used to select the window, the frame, and input focus at the same time? If so, when should pop-to-buffer be used? Aren't that unusual situations when pop-to-buffer should not also select the input focus? If you have any hints or guidelines how be a good buffer/window/frame citizen in different scenarios, that would be much appreciated. I'm not using multiple frames myself, but I'm maintaining a package called SLIME[*] which is used by a number of people who use frames. I'm not excited at all about rewriting a dozen or so uses of pop-to-buffer just to support multiple frames. There are some variables like display-buffer-reuse-frames and special-display-buffer-names and I hoped that those variables were supposed to make it easy to support multiple frames without cluttering the source code. [*] http://www.common-lisp.net/project/slime/ > >> Also note that I had to save and restore the selected frame >> around display-buffer. If I try >> >> emacs -Q --eval '(let ((pop-up-frames t)) >> (display-buffer (get-buffer-create "foo")))' >> >> the "foo" buffer is selected, even though display-buffer should not >> switch the selected window. > > I'm not sure whether on some system there were problems when raising a > frame and/or giving it input focus, and not selecting it. At least with > Emacs 22 the frame was selected already. Since there's only one window > on the new frame, that window must be selected as well. > > In any case you're right: either the window must not be selected or the > documentation should tell when and why it selects the window. The docstring of display-buffer reads "Make buffer BUFFER-OR-NAME appear in some window but don't select it. ..." I think it be would less surprising if the input focus would not be switched to the new frame. >> Not even save-window-excursion stops display-buffer from switching the >> frame: >> >> emacs -Q --eval '(save-window-excursion >> (let ((pop-up-frames t)) >> (display-buffer (get-buffer-create "foo"))))' > > `save-window-excursion' is of no use here: It permits you to change the > contents of a frame in the body and restore the initial contents > afterwards. You do that with the originally selected frame here. The > new frame created by `display-buffer' is not affected by this. save-window-excursion is supposed to "... Also restore the choice of selected window. ..." If I do emacs -Q -nw --eval '(save-window-excursion (let ((pop-up-frames t)) (display-buffer (get-buffer-create "foo"))))' I end up in the "*scratch*" buffer not in "foo". It would be more consistent if the X11 version and the tty version would restore the input focus to the same frame. The tty version is the behavior that I would expect. Helmut.