diff src/fileio.c @ 88431:d5ba4152bd1b

(Finsert_file_contents): Set coding_system to Qnil earlier. If inserted is zero and the coding system doesn't require flushing, don't call decode_coding_gap.
author Kenichi Handa <handa@m17n.org>
date Tue, 05 Mar 2002 00:09:15 +0000
parents fa717c37ad16
children 51e9e2d876e1
line wrap: on
line diff
--- a/src/fileio.c	Tue Mar 05 00:08:50 2002 +0000
+++ b/src/fileio.c	Tue Mar 05 00:09:15 2002 +0000
@@ -3594,6 +3594,10 @@
   CHECK_STRING (filename);
   filename = Fexpand_file_name (filename, Qnil);
 
+  /* The value Qnil means that the coding system is not yet
+     decided.  */
+  coding_system = Qnil;
+
   /* If the file name has special constructs in it,
      call the corresponding file handler.  */
   handler = Ffind_file_name_handler (filename, Qinsert_file_contents);
@@ -3713,9 +3717,6 @@
 	}
     }
 
-  /* The value Qnil means that the coding system is not yet
-     decided.  */
-  coding_system = Qnil;
   if (BEG < Z)
     {
       /* Decide the coding system to use for reading the file now
@@ -4405,8 +4406,9 @@
 	current_buffer->enable_multibyte_characters = Qnil;
     }
 
-  if (CODING_REQUIRE_DETECTION (&coding)
-      || CODING_REQUIRE_DECODING (&coding))
+  if ((CODING_REQUIRE_DETECTION (&coding)
+       || CODING_REQUIRE_DECODING (&coding))
+      && (inserted > 0 || CODING_REQUIRE_FLUSHING (&coding)))
     {
       move_gap_both (PT, PT_BYTE);
       GAP_SIZE += inserted;