From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel Subject: Re: Q on frame focus with MS Windows Date: Wed, 26 Oct 2005 00:21:17 +0200 Message-ID: <435EAFDD.2090207@student.lu.se> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1130278988 10161 80.91.229.2 (25 Oct 2005 22:23:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 25 Oct 2005 22:23:08 +0000 (UTC) Cc: Emacs-Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 26 00:23:06 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EUXAi-00053J-MN for ged-emacs-devel@m.gmane.org; Wed, 26 Oct 2005 00:21:33 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EUXAi-0000OT-28 for ged-emacs-devel@m.gmane.org; Tue, 25 Oct 2005 18:21:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EUXAY-0000ON-SS for emacs-devel@gnu.org; Tue, 25 Oct 2005 18:21:22 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EUXAX-0000OB-8s for emacs-devel@gnu.org; Tue, 25 Oct 2005 18:21:22 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EUXAX-0000O6-4A for emacs-devel@gnu.org; Tue, 25 Oct 2005 18:21:21 -0400 Original-Received: from [81.228.11.159] (helo=pne-smtpout2-sn1.fre.skanova.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EUXAX-0008SP-1m for emacs-devel@gnu.org; Tue, 25 Oct 2005 18:21:21 -0400 Original-Received: from [192.168.123.121] (83.249.218.244) by pne-smtpout2-sn1.fre.skanova.net (7.2.060.1) id 435CC8B20009F647; Wed, 26 Oct 2005 00:21:18 +0200 User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en Original-To: Drew Adams In-Reply-To: X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:44876 Archived-At: Drew Adams wrote: >My understanding is that it is the MS Windows window-manager that >automatically selects/focusses the new frame, and that that cannot be >prevented from within Emacs. If there is a way to inhibit this behavior, >that would be even better than getting the focus back after it has been >given to the new frame. > > I believe that the new w32 window can be created without getting the focus, but I am not sure. And it is a rather complex change that must be made. >But I don't understand what you are suggesting I do - at all. > > A workaround is maybe to use `after-make-frame-functions'? > >I already mentioned that I tried that. What do you suggest I put in that >hook, concretely? I tried reselecting the original buffer/window/frame and >the minibuffer, none of which seemed to work. > > Something like this (but it is a bit ugly): (setq pop-up-frames t default-frame-alist '((minibuffer)) minibuffer-frame-alist '((minibuffer . only))) (define-key minibuffer-local-completion-map [down] 'foo) (defvar this-frame nil) (defun foo-focus-this(frame-dummy) (run-with-idle-timer 0.1 nil 'select-frame-set-input-focus this-frame)) (defun foo () (interactive) (add-hook 'after-make-frame-functions 'foo-focus-this) (setq this-frame (selected-frame)) (display-buffer (get-buffer-create "foo")))