Subject: Re: bug#10037: 24.0.91; `isearch-mouse-2' no good with standalone minibuffer frame

From: Stefan Monnier <[email-masked]>
Date: Tue, 06 Dec 2011 20:15:40 -0500

> IOW, why wouldn't it just "work", in practice, at least most of the
> time, if `switch-frame' were not coded to exit isearch?  Just why is
> that exiting needed?

Because subsequent operations would take place in the wrong context.
The switch-frame occurs *before* and not *together with* the mouse-2
event (or at least, Emacs may very well process the switch-frame event
before receiving the mouse-2 event: it's clearly the case for me where
I use focus-follows-mouse so the switch-frame event happens as soon as
I move the mouse over the other frame, but it can also be the case in
the click-to-focus case depending on timing).

I.e. to fix this issue, we need to postpone (some part of) the
processing of switch-frame events.  E.g. Isearch could handle
switch-frame by putting itself in an "about to exit" state, but making
it work right is likely to be pretty tricky since the time where we
actually do exit would likely be something like pre-command-hook at
which point the key sequence has already been looked up in the active
keymaps which is wrong since which keymaps are active depends on whether
we should have exited Isearch or not.

        Stefan