(struct face): New fields pixmap_h, pixmap_w.
[bpt/emacs.git] / src / minibuf.c
index ebc2b8b..9b4867f 100644 (file)
@@ -1,5 +1,5 @@
 /* Minibuffer input and completion.
-   Copyright (C) 1985, 1986, 1992 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1992, 1993 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -161,27 +161,42 @@ read_minibuf (map, initial, prompt, backup_n, expflag, histvar, histpos)
 
   val = current_buffer->directory;
   Fset_buffer (get_minibuffer (minibuf_level));
-  current_buffer->directory = val;
-  Fmake_local_variable (Qprint_escape_newlines);
-  print_escape_newlines = 1;
 
-#ifdef MULTI_FRAME
-  /* If the minibuffer window is on another frame, shift this frame's
-     focus to that window, and arrange to put it back later.  */
-  if (XFRAME (WINDOW_FRAME (XWINDOW (minibuf_window)))
-      != selected_frame)
+  /* The current buffer's default directory is usually the right thing
+     for our minibuffer here.  However, if you're typing a command at
+     a minibuffer-only frame when minibuf_level is zero, then buf IS
+     the current_buffer, so reset_buffer leaves buf's default
+     directory unchanged.  This is a bummer when you've just started
+     up Emacs and buf's default directory is Qnil.  Here's a hack; can
+     you think of something better to do?  Find another buffer with a
+     better directory, and use that one instead.  */
+  if (XTYPE (val) == Lisp_String)
+    current_buffer->directory = val;
+  else
     {
-      record_unwind_protect (read_minibuf_unwind,
-                            Fcons (Fselected_frame (),
-                                   FRAME_FOCUS_FRAME (selected_frame)));
+      Lisp_Object buf_list;
+
+      for (buf_list = Vbuffer_alist;
+          CONSP (buf_list);
+          buf_list = XCONS (buf_list)->cdr)
+       {
+         Lisp_Object other_buf = XCONS (XCONS (buf_list)->car)->cdr;
 
-      Fredirect_frame_focus (Fselected_frame (), mini_frame);
+         if (XTYPE (XBUFFER (other_buf)->directory) == Lisp_String)
+           {
+             current_buffer->directory = XBUFFER (other_buf)->directory;
+             break;
+           }
+       }
     }
-  else
-    record_unwind_protect (read_minibuf_unwind, Qnil);
-#else
-  record_unwind_protect (read_minibuf_unwind, Qnil);
+
+#ifdef MULTI_FRAME
+  Fredirect_frame_focus (Fselected_frame (), mini_frame);
 #endif
+  Fmake_local_variable (Qprint_escape_newlines);
+  print_escape_newlines = 1;
+
+  record_unwind_protect (read_minibuf_unwind, Qnil);
 
   Vminibuf_scroll_window = selected_window;
   Fset_window_buffer (minibuf_window, Fcurrent_buffer ());
@@ -226,7 +241,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, histvar, histpos)
 
   /* Add the value to the appropriate history list.  */
   if (XTYPE (Vminibuffer_history_variable) == Lisp_Symbol
-      && XSYMBOL (Vminibuffer_history_variable)->value != Qunbound)
+      && ! EQ (XSYMBOL (Vminibuffer_history_variable)->value, Qunbound))
     Fset (Vminibuffer_history_variable,
          Fcons (val, Fsymbol_value (Vminibuffer_history_variable)));
 
@@ -278,6 +293,7 @@ get_minibuffer (depth)
     }
   else
     reset_buffer (XBUFFER (buf));
+
   return buf;
 }
 
@@ -311,12 +327,6 @@ read_minibuf_unwind (data)
     = minibuf_save_vector[minibuf_level].history_position;
   Vminibuffer_history_variable
     = minibuf_save_vector[minibuf_level].history_variable;
-
-#ifdef MULTI_FRAME
-  /* Redirect the focus of the frame that called the minibuffer.  */
-  if (CONSP (data))
-    Fredirect_frame_focus (XCONS (data)->car, XCONS (data)->cdr);
-#endif
 }
 \f
 
@@ -904,17 +914,12 @@ DEFUN ("completing-read", Fcompleting_read, Scompleting_read, 2, 6, 0,
 temp_echo_area_glyphs (m)
      char *m;
 {
-  /* It's not very modular to do things this way, but then it seems
-     to me that the whole echo_area_glyphs thing is a hack anyway.  */
-  extern char *previous_echo_glyphs;
-
   int osize = ZV;
   Lisp_Object oinhibit;
   oinhibit = Vinhibit_quit;
 
-  /* Clear out any old echo-area message to make way for our new
-     thing.  */
-  echo_area_glyphs = previous_echo_glyphs = 0;
+  /* Clear out any old echo-area message to make way for our new thing.  */
+  message (0);
 
   SET_PT (osize);
   insert_string (m);
@@ -925,7 +930,7 @@ temp_echo_area_glyphs (m)
   if (!NILP (Vquit_flag))
     {
       Vquit_flag = Qnil;
-      unread_command_char = Ctl ('g');
+      unread_command_events = Fcons (make_number (Ctl ('g')), Qnil);
     }
   Vinhibit_quit = oinhibit;
 }
@@ -1291,7 +1296,7 @@ or may be a list of two strings to be printed as if concatenated.")
              if (XTYPE (Vstandard_output) != Lisp_Buffer)
                {
                  Lisp_Object tem;
-                 tem = Flength (elt, Qt);
+                 tem = Flength (elt);
                  column += XINT (tem);
                }
              Fprinc (elt, Qnil);