diff src/fileio.c @ 25006:c79dc141ef5a

(Fdo_auto_save): Handle the case that echo_area_message is set. (Finsert_file_contents): Prevent redisplay optimizations. (Fread_file_name): Call it. (report_file_error): Return void.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 21 Jul 1999 21:43:52 +0000
parents 27a1d7a4c444
children 2ad9fa0386b6
line wrap: on
line diff
--- a/src/fileio.c	Wed Jul 21 21:43:52 1999 +0000
+++ b/src/fileio.c	Wed Jul 21 21:43:52 1999 +0000
@@ -141,6 +141,9 @@
 #endif
 #endif
 
+#include "commands.h"
+extern int use_dialog_box;
+
 #ifndef O_WRONLY
 #define O_WRONLY 1
 #endif
@@ -3433,6 +3436,9 @@
   if (! not_regular && st.st_size < 0)
     error ("File size is negative");
 
+  /* Prevent redisplay optimizations.  */
+  current_buffer->clip_changed = 1;
+
   if (!NILP (beg) || !NILP (end))
     if (!NILP (visit))
       error ("Attempt to visit less than an entire file");
@@ -5085,6 +5091,7 @@
   Lisp_Object tail, buf;
   int auto_saved = 0;
   char *omessage = echo_area_glyphs;
+  Lisp_Object omessage_string = echo_area_message;
   int omessage_length = echo_area_glyphs_length;
   int oldmultibyte = message_enable_multibyte;
   int do_handled_files;
@@ -5094,7 +5101,10 @@
   int count = specpdl_ptr - specpdl;
   int *ptr;
   int orig_minibuffer_auto_raise = minibuffer_auto_raise;
-
+  struct gcpro gcpro1;
+
+  GCPRO1 (omessage_string);
+  
   /* Ordinarily don't quit within this function,
      but don't make it impossible to quit (in case we get hung in I/O).  */
   oquit = Vquit_flag;
@@ -5238,7 +5248,12 @@
 
   if (auto_saved && NILP (no_message))
     {
-      if (omessage)
+      if (STRINGP (omessage_string))
+	{
+	  sit_for (1, 0, 0, 0, 0);
+	  message3 (omessage_string, omessage_length, oldmultibyte);
+	}
+      else if (omessage)
 	{
 	  sit_for (1, 0, 0, 0, 0);
 	  message2 (omessage, omessage_length, oldmultibyte);
@@ -5249,6 +5264,7 @@
 
   Vquit_flag = oquit;
 
+  UNGCPRO;
   unbind_to (count, Qnil);
   return Qnil;
 }
@@ -5485,9 +5501,20 @@
   specbind (intern ("minibuffer-completing-file-name"), Qt);
 
   GCPRO2 (insdef, default_filename);
-  val = Fcompleting_read (prompt, intern ("read-file-name-internal"),
-			  dir, mustmatch, insdef,
-			  Qfile_name_history, default_filename, Qnil);
+  
+#ifdef USE_MOTIF
+  if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
+      && use_dialog_box
+      && have_menus_p ())
+    {
+      val = Fx_file_dialog (prompt, dir, default_filename, mustmatch);
+      add_to_history = 1;
+    }
+  else
+#endif
+    val = Fcompleting_read (prompt, intern ("read-file-name-internal"),
+			    dir, mustmatch, insdef,
+			    Qfile_name_history, default_filename, Qnil);
 
   tem = Fsymbol_value (Qfile_name_history);
   if (CONSP (tem) && EQ (XCONS (tem)->car, val))
@@ -5540,8 +5567,10 @@
 	Fset (Qfile_name_history,
 	      Fcons (val1, tem));
     }
+    
   return val;
 }
+
 
 void
 init_fileio_once ()
@@ -5550,6 +5579,7 @@
   XSETFASTINT (Vdirectory_sep_char, '/');
 }
 
+
 void
 syms_of_fileio ()
 {