diff options
author | Gerd Moellmann <gerd@gnu.org> | 2001-08-29 10:32:11 +0000 |
---|---|---|
committer | Gerd Moellmann <gerd@gnu.org> | 2001-08-29 10:32:11 +0000 |
commit | d38633a3062c3010a63033081e460c8aa4a54610 (patch) | |
tree | ad23136013200f901e74bc0f2aabfd58774e40fa /src/fileio.c | |
parent | ff4ec1f7bda9fff1ff7a0550eb4170a7f6cc1261 (diff) | |
download | emacs-d38633a3062c3010a63033081e460c8aa4a54610.tar.gz |
(Finsert_file_contents): Undo change of 2001-08-27.
Diffstat (limited to 'src/fileio.c')
-rw-r--r-- | src/fileio.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/fileio.c b/src/fileio.c index f5aeaee7a03..0bd3d0221b5 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -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; } |