diff options
| author | Kenichi Handa | 2003-12-02 01:45:13 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2003-12-02 01:45:13 +0000 |
| commit | 5b359650abe55de8e83fdcd52fda6c12d9c324c7 (patch) | |
| tree | 4e611ebf8f61f6bf60cbb18a4f50e12b2b6edf9b /src | |
| parent | 16869d7e2e92b347eae0a9ee2d708f1447bf9d16 (diff) | |
| download | emacs-5b359650abe55de8e83fdcd52fda6c12d9c324c7.tar.gz emacs-5b359650abe55de8e83fdcd52fda6c12d9c324c7.zip | |
(kill_workbuf_unwind): Delete this function.
(Finsert_file_contents): Adjust the call of detect_coding_system.
Get conversion_buffer by code_conversion_save. Use the macor
CODING_MAY_REQUIRE_DECODING. After decoding, update
coding_system.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/fileio.c b/src/fileio.c index 17fcad23e4e..cb983cc78d4 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -296,16 +296,6 @@ restore_point_unwind (location) | |||
| 296 | return Qnil; | 296 | return Qnil; |
| 297 | } | 297 | } |
| 298 | 298 | ||
| 299 | /* Kill the working buffer for code conversion. */ | ||
| 300 | |||
| 301 | static Lisp_Object | ||
| 302 | kill_workbuf_unwind (workbuf) | ||
| 303 | Lisp_Object workbuf; | ||
| 304 | { | ||
| 305 | if (! NILP (workbuf) && ! NILP (Fbuffer_live_p (workbuf))) | ||
| 306 | Fkill_buffer (workbuf); | ||
| 307 | return Qnil; | ||
| 308 | } | ||
| 309 | 299 | ||
| 310 | Lisp_Object Qexpand_file_name; | 300 | Lisp_Object Qexpand_file_name; |
| 311 | Lisp_Object Qsubstitute_in_file_name; | 301 | Lisp_Object Qsubstitute_in_file_name; |
| @@ -3958,7 +3948,7 @@ actually used. */) | |||
| 3958 | 3948 | ||
| 3959 | if (CODING_REQUIRE_DETECTION (&coding)) | 3949 | if (CODING_REQUIRE_DETECTION (&coding)) |
| 3960 | { | 3950 | { |
| 3961 | coding_system = detect_coding_system (buffer, nread, 1, 0, | 3951 | coding_system = detect_coding_system (buffer, nread, nread, 1, 0, |
| 3962 | coding_system); | 3952 | coding_system); |
| 3963 | setup_coding_system (coding_system, &coding); | 3953 | setup_coding_system (coding_system, &coding); |
| 3964 | } | 3954 | } |
| @@ -4117,11 +4107,9 @@ actually used. */) | |||
| 4117 | int temp; | 4107 | int temp; |
| 4118 | int this_count = SPECPDL_INDEX (); | 4108 | int this_count = SPECPDL_INDEX (); |
| 4119 | int multibyte = ! NILP (current_buffer->enable_multibyte_characters); | 4109 | int multibyte = ! NILP (current_buffer->enable_multibyte_characters); |
| 4120 | Lisp_Object conversion_buffer | 4110 | Lisp_Object conversion_buffer; |
| 4121 | = make_conversion_work_buffer (-1, multibyte); | ||
| 4122 | struct gcpro1; | ||
| 4123 | 4111 | ||
| 4124 | record_unwind_protect (kill_workbuf_unwind, conversion_buffer); | 4112 | conversion_buffer = code_conversion_save (1, multibyte); |
| 4125 | 4113 | ||
| 4126 | /* First read the whole file, performing code conversion into | 4114 | /* First read the whole file, performing code conversion into |
| 4127 | CONVERSION_BUFFER. */ | 4115 | CONVERSION_BUFFER. */ |
| @@ -4484,8 +4472,8 @@ actually used. */) | |||
| 4484 | decide it at first by detecting the file's encoding. */ | 4472 | decide it at first by detecting the file's encoding. */ |
| 4485 | if (CODING_REQUIRE_DETECTION (&coding)) | 4473 | if (CODING_REQUIRE_DETECTION (&coding)) |
| 4486 | { | 4474 | { |
| 4487 | coding_system = detect_coding_system (PT_ADDR, inserted, 1, 0, | 4475 | coding_system = detect_coding_system (PT_ADDR, inserted, inserted, |
| 4488 | coding_system); | 4476 | 1, 0, coding_system); |
| 4489 | setup_coding_system (coding_system, &coding); | 4477 | setup_coding_system (coding_system, &coding); |
| 4490 | } | 4478 | } |
| 4491 | 4479 | ||
| @@ -4498,8 +4486,7 @@ actually used. */) | |||
| 4498 | } | 4486 | } |
| 4499 | 4487 | ||
| 4500 | coding.dst_multibyte = ! NILP (current_buffer->enable_multibyte_characters); | 4488 | coding.dst_multibyte = ! NILP (current_buffer->enable_multibyte_characters); |
| 4501 | if ((CODING_REQUIRE_DETECTION (&coding) | 4489 | if (CODING_MAY_REQUIRE_DECODING (&coding) |
| 4502 | || CODING_REQUIRE_DECODING (&coding)) | ||
| 4503 | && (inserted > 0 || CODING_REQUIRE_FLUSHING (&coding))) | 4490 | && (inserted > 0 || CODING_REQUIRE_FLUSHING (&coding))) |
| 4504 | { | 4491 | { |
| 4505 | move_gap_both (PT, PT_BYTE); | 4492 | move_gap_both (PT, PT_BYTE); |
| @@ -4510,6 +4497,7 @@ actually used. */) | |||
| 4510 | Z -= inserted; | 4497 | Z -= inserted; |
| 4511 | decode_coding_gap (&coding, inserted, inserted); | 4498 | decode_coding_gap (&coding, inserted, inserted); |
| 4512 | inserted = coding.produced_char; | 4499 | inserted = coding.produced_char; |
| 4500 | coding_system = CODING_ID_NAME (coding.id); | ||
| 4513 | } | 4501 | } |
| 4514 | else if (inserted > 0) | 4502 | else if (inserted > 0) |
| 4515 | adjust_after_insert (PT, PT_BYTE, PT + inserted, PT_BYTE + inserted, | 4503 | adjust_after_insert (PT, PT_BYTE, PT + inserted, PT_BYTE + inserted, |