]> git.eshelyaron.com Git - emacs.git/commitdiff
(Finsert_file_contents): Don't do position adjustments
authorKenichi Handa <handa@m17n.org>
Thu, 12 Mar 1998 00:38:28 +0000 (00:38 +0000)
committerKenichi Handa <handa@m17n.org>
Thu, 12 Mar 1998 00:38:28 +0000 (00:38 +0000)
and handling post-read-conversion here, they are done in
code_convert_region.  Even if a file is read by no-conversion,
call adjust_after_replace to adjust positions.

src/fileio.c

index 4006bf839aa4c504bc8d1d88ffde7845370486b1..7def34b7dcba13e125ac13fef70ccfee16a5b992 100644 (file)
@@ -3776,6 +3776,25 @@ This does code conversion according to the value of\n\
          inserted = (NILP (current_buffer->enable_multibyte_characters)
                      ? coding.produced : coding.produced_char);
        }
+      else if (!NILP (current_buffer->enable_multibyte_characters))
+       {
+         int inserted_byte = inserted;
+
+         /* At first, reset positions to the state of before
+             insertion.  */
+         GAP_SIZE += inserted;
+         GPT_BYTE -= inserted;
+         ZV_BYTE -= inserted;
+         Z_BYTE -= inserted;
+         GPT -= inserted;
+         ZV -= inserted;
+         Z -= inserted;
+
+         /* Then adjust positions.  */
+         inserted = multibyte_chars_in_text (GPT_ADDR, inserted);
+         adjust_after_replace (PT, PT_BYTE, PT, PT_BYTE,
+                               inserted, inserted_byte);
+       }
 
 #ifdef DOS_NT
       /* Use the conversion type to determine buffer-file-type
@@ -3787,24 +3806,6 @@ This does code conversion according to the value of\n\
       else
        current_buffer->buffer_file_type = Qt;
 #endif
-
-      record_insert (PT, inserted);
-
-      /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */
-      offset_intervals (current_buffer, PT, inserted);
-      MODIFF++;
-
-      if (! NILP (coding.post_read_conversion))
-       {
-         Lisp_Object val;
-
-         val = call1 (coding.post_read_conversion, make_number (inserted));
-         if (!NILP (val))
-           {
-             CHECK_NUMBER (val, 0);
-             inserted = XFASTINT (val);
-           }
-       }
     }
 
   set_coding_system = 1;