comparison src/coding.c @ 30315:8067ad173141

(code_convert_region): Delete text properties before shrinking the conversion region.
author Kenichi Handa <handa@m17n.org>
date Wed, 19 Jul 2000 03:44:55 +0000
parents 14a9937df1f5
children d81bc1a374d6
comparison
equal deleted inserted replaced
30314:86c821099ed8 30315:8067ad173141
4716 } 4716 }
4717 4717
4718 if (replace) 4718 if (replace)
4719 { 4719 {
4720 int saved_from = from; 4720 int saved_from = from;
4721 int saved_inhibit_modification_hooks;
4721 4722
4722 prepare_to_modify_buffer (from, to, &from); 4723 prepare_to_modify_buffer (from, to, &from);
4723 if (saved_from != from) 4724 if (saved_from != from)
4724 { 4725 {
4725 to = from + len; 4726 to = from + len;
4726 from_byte = CHAR_TO_BYTE (from), to_byte = CHAR_TO_BYTE (to); 4727 from_byte = CHAR_TO_BYTE (from), to_byte = CHAR_TO_BYTE (to);
4727 len_byte = to_byte - from_byte; 4728 len_byte = to_byte - from_byte;
4728 } 4729 }
4730
4731 /* The code conversion routine can not preserve text properties
4732 for now. So, we must remove all text properties in the
4733 region. Here, we must suppress all modification hooks. */
4734 saved_inhibit_modification_hooks = inhibit_modification_hooks;
4735 inhibit_modification_hooks = 1;
4736 Fset_text_properties (make_number (from), make_number (to), Qnil, Qnil);
4737 inhibit_modification_hooks = saved_inhibit_modification_hooks;
4729 } 4738 }
4730 4739
4731 if (! encodep && CODING_REQUIRE_DETECTION (coding)) 4740 if (! encodep && CODING_REQUIRE_DETECTION (coding))
4732 { 4741 {
4733 /* We must detect encoding of text and eol format. */ 4742 /* We must detect encoding of text and eol format. */
4838 tail_skip = to_byte_orig - to_byte; 4847 tail_skip = to_byte_orig - to_byte;
4839 total_skip = head_skip + tail_skip; 4848 total_skip = head_skip + tail_skip;
4840 from += head_skip; 4849 from += head_skip;
4841 to -= tail_skip; 4850 to -= tail_skip;
4842 len -= total_skip; len_byte -= total_skip; 4851 len -= total_skip; len_byte -= total_skip;
4843 }
4844
4845 /* The code conversion routine can not preserve text properties for
4846 now. So, we must remove all text properties in the region.
4847 Here, we must suppress all modification hooks. */
4848 if (replace)
4849 {
4850 int saved_inhibit_modification_hooks = inhibit_modification_hooks;
4851 inhibit_modification_hooks = 1;
4852 Fset_text_properties (make_number (from), make_number (to), Qnil, Qnil);
4853 inhibit_modification_hooks = saved_inhibit_modification_hooks;
4854 } 4852 }
4855 4853
4856 /* For converion, we must put the gap before the text in addition to 4854 /* For converion, we must put the gap before the text in addition to
4857 making the gap larger for efficient decoding. The required gap 4855 making the gap larger for efficient decoding. The required gap
4858 size starts from 2000 which is the magic number used in make_gap. 4856 size starts from 2000 which is the magic number used in make_gap.