emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: put input focus on active minibuffer


From: Katsumi Yamaoka
Subject: Re: put input focus on active minibuffer
Date: Tue, 23 Feb 2016 08:43:06 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (i686-pc-cygwin)

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,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]