Subject: bug#11939: 24.1; `save-buffers-kill-emacs' loses minibuffer focus when itcalls `list-processes'

From: martin rudalics <[email-masked]>
Date: Sun, 22 Jul 2012 10:49:31 +0200

>> Usually, each frame must have a minibuffer window.  How else should
 >> `read-minibuffer' work?
 >
 > It can read from the minibuffer in a standalone minibuffer frame?

Is this a question or an answer?

 > That's what I was guessing, that a frame's `minibuffer' parameter might be
 > non-nil but it somehow has a minibuffer _window_.  Seems odd, but I guess these
 > things are at two different levels.  I am used to the Lisp & frame level - I
 > know almost nothing about the C & window level.

Emacs must be able to work internally even if you make all your frames
minibuffer-less.

 >> `mouse-leave-buffer-hook' and in a `pre-' or
 >> `post-command-hook' check whether that something got executed.
 >> Then you can be sure that somewhere in between a
 >> `handle-switch-frame' interfered.
 >
 > Sorry, I don't follow you (and I haven't found where you suggested something
 > similar earlier).  If you can be more specific I'll be glad to try whatever you
 > ask.

When you want to check of `handle-switch-frame' executions you cannot
trace otherwise and you do not run emacs in the debugger, the most
simple way to trace these is to put some function on
`mouse-leave-buffer-hook', and inspect the output of that function later
on.

 > All I meant was that (I'm guessing that):
 >
 > a. Emacs asks the question, directing focus to the minibuffer frame for the user
 > to input a response.
 >
 > b. MS Windows creates the new frame and gives it the focus, taking the focus
 > away from the minibuffer.

I can live with that assumption.

 >>  > As I mentioned in my other reply today, you can, when the
 >>  > minibuffer is active, explicitly switch the focus to the
 >>  > *Completions* frame, to do something there
 >>  > (e.g. move to some completion candidate).
 >>
 >> Which function precisely does that?
 >
 > With just oneonone.el loaded (which creates a standalone minibuffer and
 > special-display *Help* and *Completions*, with the latter frame redirected to
 > the minibuffer frame), even just `C-x o' during completion will do it.  I.e.,
 > from the minibuffer, `C-x o' moves you (focus) to *Completions*.
 >
 > Or you can click *Completions* with the mouse - same effect.
 >
 > In Icicles, you can use C-<insert> to flip back and forth between the minibuffer
 > and *Completions*.  C-<insert> is command `switch-to-*Completions*' in the
 > minibuffer completion keymaps, and C-<insert> is command
 > `icicle-insert-completion' in keymap `completion-list-mode-map'.

I see.  On first reading I missed the term "explictly".  IIUC what we
need is a mechansim that switches frames implicitly to the minibuffer
frame.

martin