]> git.eshelyaron.com Git - emacs.git/commitdiff
(Finsert_file_contents): Undo change of 2001-08-27.
authorGerd Moellmann <gerd@gnu.org>
Wed, 29 Aug 2001 10:32:11 +0000 (10:32 +0000)
committerGerd Moellmann <gerd@gnu.org>
Wed, 29 Aug 2001 10:32:11 +0000 (10:32 +0000)
src/ChangeLog
src/fileio.c

index 63a749d0a98b521c7f46c7ece625b9ef40da509e..0edac415aa826bcd2801e617f9ad87319e0907b8 100644 (file)
@@ -1,3 +1,7 @@
+2001-08-29  Gerd Moellmann  <gerd@gnu.org>
+
+       * fileio.c (Finsert_file_contents): Undo change of 2001-08-27.
+
 2001-08-28  Eli Zaretskii  <eliz@is.elta.co.il>
 
        * w32term.c (x_set_glyph_string_background_width)
index f5aeaee7a03889245a14591054d929e932669892..0bd3d0221b5f367f516b92b6e387f9cbb68717e3 100644 (file)
@@ -4350,10 +4350,21 @@ actually used.")
          || coding.type == coding_type_raw_text))
     {
       /* Visiting a file with these coding systems should always make
-        the buffer unibyte.  The call to Fset_buffer_multibyte
-        ensures that existing markers etc are converted to unibyte,
-        too.  */
-      Fset_buffer_multibyte (Qnil);
+        the buffer unibyte.  If we happen to be replacing text in a
+        multibyte buffer (this happens when reverting an RMAIL
+        buffer), positions in the buffer, markers etc. may have byte
+        positions != character positions, so just setting
+        enable_multibyte_characters to nil doesn't suffice.  */
+      if (!NILP (replace)
+         && !NILP (current_buffer->enable_multibyte_characters))
+       Fset_buffer_multibyte (Qnil);
+      else
+       /* We cannot Fset_buffer_multibyte(nil) here.  When we visit a
+          file literally in a multibyte buffer, a call to
+          Fset_buffer_multibyte would change character positions,
+          although the buffer has unibyte contents, and that's wrong,
+          of course.  */
+       current_buffer->enable_multibyte_characters = Qnil;
       coding.dst_multibyte = 0;
     }