From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.devel Subject: Re: put input focus on active minibuffer Date: Tue, 23 Feb 2016 08:43:06 +0900 Organization: Emacsen advocacy group Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1456184654 17071 80.91.229.3 (22 Feb 2016 23:44:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 22 Feb 2016 23:44:14 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 23 00:44:05 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aY096-0001C4-W8 for ged-emacs-devel@m.gmane.org; Tue, 23 Feb 2016 00:44:05 +0100 Original-Received: from localhost ([::1]:52694 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aY096-0002iJ-Ar for ged-emacs-devel@m.gmane.org; Mon, 22 Feb 2016 18:44:04 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51017) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aY08t-0002hK-15 for emacs-devel@gnu.org; Mon, 22 Feb 2016 18:43:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aY08p-0003xI-Rp for emacs-devel@gnu.org; Mon, 22 Feb 2016 18:43:50 -0500 Original-Received: from mail-hampton.hostforweb.net ([205.234.186.191]:42344 helo=hampton.hostforweb.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aY08p-0003sm-OF for emacs-devel@gnu.org; Mon, 22 Feb 2016 18:43:47 -0500 Original-Received: from s70.gtokyofl21.vectant.ne.jp ([202.215.75.70]:60760 helo=localhost) by hampton.hostforweb.net with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.86) (envelope-from ) id 1aY085-002Z7w-Li; Mon, 22 Feb 2016 17:43:03 -0600 X-Face: #kKnN,xUnmKia.'[pp`; Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu; B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (i686-pc-cygwin) Cancel-Lock: sha1:bYS4Tl2Qf+iIBc3e9tbEB7YWZTk= X-OutGoing-Spam-Status: No, score=-2.9 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - hampton.hostforweb.net X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Get-Message-Sender-Via: hampton.hostforweb.net: authenticated_id: yamaoka/from_h X-Authenticated-Sender: hampton.hostforweb.net: yamaoka@jpl.org X-Source: X-Source-Args: X-Source-Dir: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (barebone) [generic] X-Received-From: 205.234.186.191 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:200511 Archived-At: On Fri, 19 Feb 2016 18:26:36 -0800, John Wiegley wrote: > Since Emacs allows the use of other buffers while the minibuffer is waiting > for input, it's not uncommon to click on the window you want to interact with, > regardless of whether a question is being asked. So I don't think we can > change the default behavior to switch window focus based on such a question in > the minibuffer. Agreed. To tell the truth, I'm not necessarily sure if the feature is really useful for me because I've never experienced it so far. > However, it does sound like an interesting configuration option, as I've > indeed been in that scenario many times before. My recommendation would be to > try out the code Alexis offered, and come back after some time has passed if > you feel the change improves your experience well enough that it should become > a standard option. Thanks for following it up, and sorry for my no response (as my circuit design work is piled up these days). I tried Alexis' solution below but it changed nothing in at least Cygwin. #+BEGIN_SRC emacs-lisp (defun focus-to-active-minibuffer () (if (minibuffer-window-active-p (minibuffer-window)) (select-window (minibuffer-window)))) (add-hook 'focus-in-hook #'focus-to-active-minibuffer) #+END_SRC When I eval'd (read-file-name "What? ") in the *scratch* buffer, selected another frame of the desktop, and clicked the *scratch* window to re-select the Emacs frame in question, I could verify `focus-to-active-minibuffer' was called and it selected the minibuffer window (using edebug). However, the cursor moved to the *scratch* window after the hook function exited. I guess whether this does work might depend on the windowing system. If so, I can imagine it's not an easy matter to solve. Anyway I think it's good if such an option were available. It has not to be turned on by default of course. Regards,