+
+Lisp_Object Quser_variable_p;
+
+Lisp_Object Qminibuffer_default;
+
+Lisp_Object Qcurrent_input_method, Qactivate_input_method;
+
+extern Lisp_Object Qmouse_face;
+\f
+/* Put minibuf on currently selected frame's minibuffer.
+ We do this whenever the user starts a new minibuffer
+ or when a minibuffer exits. */
+
+void
+choose_minibuf_frame ()
+{
+ if (selected_frame != 0
+ && !EQ (minibuf_window, selected_frame->minibuffer_window))
+ {
+ /* I don't think that any frames may validly have a null minibuffer
+ window anymore. */
+ if (NILP (selected_frame->minibuffer_window))
+ abort ();
+
+ Fset_window_buffer (selected_frame->minibuffer_window,
+ XWINDOW (minibuf_window)->buffer);
+ minibuf_window = selected_frame->minibuffer_window;
+ }
+
+ /* Make sure no other frame has a minibuffer as its selected window,
+ because the text would not be displayed in it, and that would be
+ confusing. Only allow the selected frame to do this,
+ and that only if the minibuffer is active. */
+ {
+ Lisp_Object tail, frame;
+
+ FOR_EACH_FRAME (tail, frame)
+ if (MINI_WINDOW_P (XWINDOW (FRAME_SELECTED_WINDOW (XFRAME (frame))))
+ && !(XFRAME (frame) == selected_frame
+ && minibuf_level > 0))
+ Fset_frame_selected_window (frame, Fframe_first_window (frame));
+ }
+}
+
+Lisp_Object
+choose_minibuf_frame_1 (ignore)
+ Lisp_Object ignore;
+{
+ choose_minibuf_frame ();
+ return Qnil;
+}
+
+DEFUN ("set-minibuffer-window", Fset_minibuffer_window,
+ Sset_minibuffer_window, 1, 1, 0,
+ "Specify which minibuffer window to use for the minibuffer.\n\
+This effects where the minibuffer is displayed if you put text in it\n\
+without invoking the usual minibuffer commands.")
+ (window)
+ Lisp_Object window;
+{
+ CHECK_WINDOW (window, 1);
+ if (! MINI_WINDOW_P (XWINDOW (window)))
+ error ("Window is not a minibuffer window");
+
+ minibuf_window = window;
+
+ return window;
+}
+