[Top][All Lists]

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

Re: completing-read (and M-x) with pop-up-frames non-nil changes frame f

From: Stefan Monnier
Subject: Re: completing-read (and M-x) with pop-up-frames non-nil changes frame focus
Date: Fri, 15 Jul 2005 01:27:08 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> emacs -q
> M-x set-variable pop-up-frames t
> M-x complet TAB

> This opens a new frame for buffer *Completions*. At least in Windows, the
> new frame is selected. The frame focus for typing key sequences thus
> switches to the *Completions* frame, but the minibuffer of the original
> frame is still waiting for input. So, you cannot continue to type, to
> disambiguate the command you want.

Maybe this is related to the following comment in the docstring of

   This function itself does not make the new frame the selected frame.
   The previously selected frame remains selected.  However, the
   window system may select the new frame for its own reasons, for
   instance if the frame appears under the mouse pointer and your
   setup is for focus to follow the pointer.

So maybe Fdisplay_buffer should protect against it with something like the
patch below.  Does it help?


--- orig/src/window.c
+++ mod/src/window.c
@@ -3493,7 +3493,10 @@
      we need to create a new frame.  */
   if (pop_up_frames || last_nonminibuf_frame == 0)
+      Lisp_Object w = Fselected_window ();
       window = Fframe_selected_window (call0 (Vpop_up_frame_function));
+      if (Fwindow_live_p w)
+       Fselect_window (w, Qt);
       Fset_window_buffer (window, buffer, Qnil);
       Fset_window_dedicated_p (window, intern ("soft"));
       return display_buffer_1 (window);

reply via email to

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