aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2001-08-30 08:24:22 +0000
committerGerd Moellmann2001-08-30 08:24:22 +0000
commit24766480cf30e0b283a1929a4aa107f5976981be (patch)
tree19a29d26c8a88ff276d0c705d02e003608db088c /src
parentc05516490426dd6206b51ae94dd6ad0e1ab8eb76 (diff)
downloademacs-24766480cf30e0b283a1929a4aa107f5976981be.tar.gz
emacs-24766480cf30e0b283a1929a4aa107f5976981be.zip
(Finsert_file_contents): Don't change the multibyteness
of the buffer if REPLACE is non-nil.
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 0bd3d0221b5..1a90e511322 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4346,25 +4346,14 @@ actually used.")
4346 } 4346 }
4347 4347
4348 if (!NILP (visit) 4348 if (!NILP (visit)
4349 /* Can't do this if part of the buffer might be preserved. */
4350 && NILP (replace)
4349 && (coding.type == coding_type_no_conversion 4351 && (coding.type == coding_type_no_conversion
4350 || coding.type == coding_type_raw_text)) 4352 || coding.type == coding_type_raw_text))
4351 { 4353 {
4352 /* Visiting a file with these coding systems should always make 4354 /* Visiting a file with these coding system makes the buffer
4353 the buffer unibyte. If we happen to be replacing text in a 4355 unibyte. */
4354 multibyte buffer (this happens when reverting an RMAIL 4356 current_buffer->enable_multibyte_characters = Qnil;
4355 buffer), positions in the buffer, markers etc. may have byte
4356 positions != character positions, so just setting
4357 enable_multibyte_characters to nil doesn't suffice. */
4358 if (!NILP (replace)
4359 && !NILP (current_buffer->enable_multibyte_characters))
4360 Fset_buffer_multibyte (Qnil);
4361 else
4362 /* We cannot Fset_buffer_multibyte(nil) here. When we visit a
4363 file literally in a multibyte buffer, a call to
4364 Fset_buffer_multibyte would change character positions,
4365 although the buffer has unibyte contents, and that's wrong,
4366 of course. */
4367 current_buffer->enable_multibyte_characters = Qnil;
4368 coding.dst_multibyte = 0; 4357 coding.dst_multibyte = 0;
4369 } 4358 }
4370 4359