diff options
| author | Kenichi Handa | 1998-03-12 00:38:28 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1998-03-12 00:38:28 +0000 |
| commit | f8198e198dc5274b5ee46bddda5d31e52f2979b2 (patch) | |
| tree | 755eee425b47293898b18494e45c20971ad00b0c | |
| parent | 1f90a790f50b7c848f97a0c0b9d95a045826e033 (diff) | |
| download | emacs-f8198e198dc5274b5ee46bddda5d31e52f2979b2.tar.gz emacs-f8198e198dc5274b5ee46bddda5d31e52f2979b2.zip | |
(Finsert_file_contents): Don't do position adjustments
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.
| -rw-r--r-- | src/fileio.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/src/fileio.c b/src/fileio.c index 4006bf839aa..7def34b7dcb 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -3776,6 +3776,25 @@ This does code conversion according to the value of\n\ | |||
| 3776 | inserted = (NILP (current_buffer->enable_multibyte_characters) | 3776 | inserted = (NILP (current_buffer->enable_multibyte_characters) |
| 3777 | ? coding.produced : coding.produced_char); | 3777 | ? coding.produced : coding.produced_char); |
| 3778 | } | 3778 | } |
| 3779 | else if (!NILP (current_buffer->enable_multibyte_characters)) | ||
| 3780 | { | ||
| 3781 | int inserted_byte = inserted; | ||
| 3782 | |||
| 3783 | /* At first, reset positions to the state of before | ||
| 3784 | insertion. */ | ||
| 3785 | GAP_SIZE += inserted; | ||
| 3786 | GPT_BYTE -= inserted; | ||
| 3787 | ZV_BYTE -= inserted; | ||
| 3788 | Z_BYTE -= inserted; | ||
| 3789 | GPT -= inserted; | ||
| 3790 | ZV -= inserted; | ||
| 3791 | Z -= inserted; | ||
| 3792 | |||
| 3793 | /* Then adjust positions. */ | ||
| 3794 | inserted = multibyte_chars_in_text (GPT_ADDR, inserted); | ||
| 3795 | adjust_after_replace (PT, PT_BYTE, PT, PT_BYTE, | ||
| 3796 | inserted, inserted_byte); | ||
| 3797 | } | ||
| 3779 | 3798 | ||
| 3780 | #ifdef DOS_NT | 3799 | #ifdef DOS_NT |
| 3781 | /* Use the conversion type to determine buffer-file-type | 3800 | /* Use the conversion type to determine buffer-file-type |
| @@ -3787,24 +3806,6 @@ This does code conversion according to the value of\n\ | |||
| 3787 | else | 3806 | else |
| 3788 | current_buffer->buffer_file_type = Qt; | 3807 | current_buffer->buffer_file_type = Qt; |
| 3789 | #endif | 3808 | #endif |
| 3790 | |||
| 3791 | record_insert (PT, inserted); | ||
| 3792 | |||
| 3793 | /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ | ||
| 3794 | offset_intervals (current_buffer, PT, inserted); | ||
| 3795 | MODIFF++; | ||
| 3796 | |||
| 3797 | if (! NILP (coding.post_read_conversion)) | ||
| 3798 | { | ||
| 3799 | Lisp_Object val; | ||
| 3800 | |||
| 3801 | val = call1 (coding.post_read_conversion, make_number (inserted)); | ||
| 3802 | if (!NILP (val)) | ||
| 3803 | { | ||
| 3804 | CHECK_NUMBER (val, 0); | ||
| 3805 | inserted = XFASTINT (val); | ||
| 3806 | } | ||
| 3807 | } | ||
| 3808 | } | 3809 | } |
| 3809 | 3810 | ||
| 3810 | set_coding_system = 1; | 3811 | set_coding_system = 1; |