Subject: bug#12766: read-from-minibuffer does not preserve current-buffer

From: martin rudalics <[email-masked]>
Date: Wed, 31 Oct 2012 11:27:15 +0100

> Right, I would expect it to fix the problem, indeed.  IOW, please
 > install.

Installed in revision 110748 on trunk.

 > But I still wonder, how come this was not needed earlier.

I didn't go through it but IIUC read_minibuf calls choose_minibuf_frame
which calls Fset_frame_selected_window for each frame which now, for the
selected window, unconditionally makes its buffer current.

For me the fact that unwinding a sequence of operations as

   choose_minibuf_frame ();

   record_unwind_protect (choose_minibuf_frame_1, Qnil);

   record_unwind_protect (Fset_window_configuration,
                          Fcurrent_window_configuration (Qnil));

   record_unwind_protect (Fset_window_configuration,
                          Fcurrent_window_configuration (mini_frame));

would work in practice constitutes a miracle already.

martin