From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.help Subject: Re: switch-to-buffer-other-frame changes focus/mouse to that other frame Date: Sat, 16 Oct 2010 09:56:32 +0200 Message-ID: <4CB95AB0.30007@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1287216739 859 80.91.229.12 (16 Oct 2010 08:12:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 16 Oct 2010 08:12:19 +0000 (UTC) To: Herbert.Zidek@epcos.com, help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Oct 16 10:12:18 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P71sD-0006oT-A9 for geh-help-gnu-emacs@m.gmane.org; Sat, 16 Oct 2010 10:12:13 +0200 Original-Received: from localhost ([127.0.0.1]:41607 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P71sB-0001hZ-Uz for geh-help-gnu-emacs@m.gmane.org; Sat, 16 Oct 2010 04:12:12 -0400 Original-Received: from [140.186.70.92] (port=37336 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P71lk-00088B-H7 for help-gnu-emacs@gnu.org; Sat, 16 Oct 2010 04:05:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P71d7-0000N5-0h for help-gnu-emacs@gnu.org; Sat, 16 Oct 2010 03:56:37 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.23]:50442 helo=mail.gmx.net) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1P71d6-0000Mn-Ll for help-gnu-emacs@gnu.org; Sat, 16 Oct 2010 03:56:36 -0400 Original-Received: (qmail invoked by alias); 16 Oct 2010 07:56:33 -0000 Original-Received: from 62-47-56-251.adsl.highway.telekom.at (EHLO [62.47.56.251]) [62.47.56.251] by mail.gmx.net (mp065) with SMTP; 16 Oct 2010 09:56:33 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18YyTknBEMYzWNbINlvkvk+uH7GUaKtO+Jcm/sv3X +rJHJXjmYAnVbR User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) Original-References: 4CB81B70.4010200@epcos.com X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:75138 Archived-At: > A "switch-to-buffer-other-frame" switches to a (newly created) > frame, but keeps the focus (and the mouse) on it's current > location in > > GNU Emacs 22.1.1 (x86_64-suse-linux-gnu, GTK+ Version 2.12.0) > of 2008-05-16 on willimas > > as a "switch-to-buffer-other-window" (with pop-up-frames==f) does. > > > However, the same "switch-to-buffer-other-frame" in > > GNU Emacs 23.1.1 (x86_64-suse-linux-gnu, GTK+ Version 2.18.6) > of 2010-04-01 on build17 > > gives the focus to (and places the mouse in) the (newly created) > frame. > > > I don't want to focus on the other-frame in this situation. > How can I avoid this behavior of Emacs 23.1.1? You can't, due to possible race conditions with the window manager :-( Note that `switch-to-buffer-other-frame' is not a good example in this context. By design, this function permanently selects the window it uses for showing the buffer and, implicitly, that window's frame. Hence it's only natural that it does also focus that frame. But the problem you describe already occurs with `display-buffer' which, by design, should _not_ select the window where it displays the buffer. If, however, `display-buffer' shows the buffer in a new frame, it also transfers focus to that frame and raises it. Emacs 23 transfers focus even when it _reuses_ an existing frame - there was a longer discussion on this somehwere around 2007 or 2008 but I don't recall the title of the thread any more. It's probably most instructive to look at the rather ill-fated function `display-buffer-other-frame' in files.el. If we can fix this, we could try to make the do-not-transfer-focus behavior optional at least on all those systems that support it reliably. martin