aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.c
diff options
context:
space:
mode:
authorKenichi Handa2003-04-08 07:26:05 +0000
committerKenichi Handa2003-04-08 07:26:05 +0000
commit1c7457e2944e6724a44b795b5bd0bca3b7310e47 (patch)
treebfd62e71328acfd665eaf59b71b06e672845f659 /src/coding.c
parent4fbc4b1705e9dd72b3a175961f23f084f237d7db (diff)
downloademacs-1c7457e2944e6724a44b795b5bd0bca3b7310e47.tar.gz
emacs-1c7457e2944e6724a44b795b5bd0bca3b7310e47.zip
(code_convert_region_unwind): Set
Vlast_coding_system_used to the argument. (code_convert_region): If post-read-conversion function changed the value of last-coding-sytem, keep the new value in coding->symbol so that it won't be overridden. (run_pre_post_conversion_on_str): Likewise.
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/coding.c b/src/coding.c
index f5b4f808681..f35018e7151 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -2897,7 +2897,7 @@ detect_coding_utf_16 (src, src_end, multibytep)
2897 int multibytep; 2897 int multibytep;
2898{ 2898{
2899 unsigned char c1, c2; 2899 unsigned char c1, c2;
2900 /* Dummy for TWO_MORE_BYTES. */ 2900 /* Dummy for ONE_MORE_BYTE_CHECK_MULTIBYTE. */
2901 struct coding_system dummy_coding; 2901 struct coding_system dummy_coding;
2902 struct coding_system *coding = &dummy_coding; 2902 struct coding_system *coding = &dummy_coding;
2903 2903
@@ -5200,10 +5200,11 @@ static int shrink_conversion_region_threshhold = 1024;
5200 } while (0) 5200 } while (0)
5201 5201
5202static Lisp_Object 5202static Lisp_Object
5203code_convert_region_unwind (dummy) 5203code_convert_region_unwind (arg)
5204 Lisp_Object dummy; 5204 Lisp_Object arg;
5205{ 5205{
5206 inhibit_pre_post_conversion = 0; 5206 inhibit_pre_post_conversion = 0;
5207 Vlast_coding_system_used = arg;
5207 return Qnil; 5208 return Qnil;
5208} 5209}
5209 5210
@@ -5447,7 +5448,8 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace)
5447 struct buffer *prev = current_buffer; 5448 struct buffer *prev = current_buffer;
5448 Lisp_Object new; 5449 Lisp_Object new;
5449 5450
5450 record_unwind_protect (code_convert_region_unwind, Qnil); 5451 record_unwind_protect (code_convert_region_unwind,
5452 Vlatin_extra_code_table);
5451 /* We should not call any more pre-write/post-read-conversion 5453 /* We should not call any more pre-write/post-read-conversion
5452 functions while this pre-write-conversion is running. */ 5454 functions while this pre-write-conversion is running. */
5453 inhibit_pre_post_conversion = 1; 5455 inhibit_pre_post_conversion = 1;
@@ -5805,16 +5807,22 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace)
5805 && ! encodep && ! NILP (coding->post_read_conversion)) 5807 && ! encodep && ! NILP (coding->post_read_conversion))
5806 { 5808 {
5807 Lisp_Object val; 5809 Lisp_Object val;
5810 Lisp_Object saved_coding_system;
5808 5811
5809 if (from != PT) 5812 if (from != PT)
5810 TEMP_SET_PT_BOTH (from, from_byte); 5813 TEMP_SET_PT_BOTH (from, from_byte);
5811 prev_Z = Z; 5814 prev_Z = Z;
5812 record_unwind_protect (code_convert_region_unwind, Qnil); 5815 record_unwind_protect (code_convert_region_unwind,
5816 Vlast_coding_system_used);
5817 saved_coding_system = Vlast_coding_system_used;
5818 Vlast_coding_system_used = coding->symbol;
5813 /* We should not call any more pre-write/post-read-conversion 5819 /* We should not call any more pre-write/post-read-conversion
5814 functions while this post-read-conversion is running. */ 5820 functions while this post-read-conversion is running. */
5815 inhibit_pre_post_conversion = 1; 5821 inhibit_pre_post_conversion = 1;
5816 val = call1 (coding->post_read_conversion, make_number (inserted)); 5822 val = call1 (coding->post_read_conversion, make_number (inserted));
5817 inhibit_pre_post_conversion = 0; 5823 inhibit_pre_post_conversion = 0;
5824 coding->symbol = Vlast_coding_system_used;
5825 Vlast_coding_system_used = saved_coding_system;
5818 /* Discard the unwind protect. */ 5826 /* Discard the unwind protect. */
5819 specpdl_ptr--; 5827 specpdl_ptr--;
5820 CHECK_NUMBER (val); 5828 CHECK_NUMBER (val);
@@ -5860,7 +5868,8 @@ run_pre_post_conversion_on_str (str, coding, encodep)
5860 Lisp_Object old_deactivate_mark; 5868 Lisp_Object old_deactivate_mark;
5861 5869
5862 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); 5870 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
5863 record_unwind_protect (code_convert_region_unwind, Qnil); 5871 record_unwind_protect (code_convert_region_unwind,
5872 Vlast_coding_system_used);
5864 /* It is not crucial to specbind this. */ 5873 /* It is not crucial to specbind this. */
5865 old_deactivate_mark = Vdeactivate_mark; 5874 old_deactivate_mark = Vdeactivate_mark;
5866 GCPRO2 (str, old_deactivate_mark); 5875 GCPRO2 (str, old_deactivate_mark);
@@ -5890,8 +5899,10 @@ run_pre_post_conversion_on_str (str, coding, encodep)
5890 call2 (coding->pre_write_conversion, make_number (BEG), make_number (Z)); 5899 call2 (coding->pre_write_conversion, make_number (BEG), make_number (Z));
5891 else 5900 else
5892 { 5901 {
5902 Vlast_coding_system_used = coding->symbol;
5893 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 5903 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
5894 call1 (coding->post_read_conversion, make_number (Z - BEG)); 5904 call1 (coding->post_read_conversion, make_number (Z - BEG));
5905 coding->symbol = Vlast_coding_system_used;
5895 } 5906 }
5896 inhibit_pre_post_conversion = 0; 5907 inhibit_pre_post_conversion = 0;
5897 Vdeactivate_mark = old_deactivate_mark; 5908 Vdeactivate_mark = old_deactivate_mark;