aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.c
diff options
context:
space:
mode:
authorKenichi Handa2000-07-19 03:44:55 +0000
committerKenichi Handa2000-07-19 03:44:55 +0000
commite077cc80af15ba30231f3e921389415c6a22a59d (patch)
treed6d2119671d717c6db110c66437496c98c1e10b0 /src/coding.c
parent670acd6287b0482e1cf54cb44d3eaf93f3ca1405 (diff)
downloademacs-e077cc80af15ba30231f3e921389415c6a22a59d.tar.gz
emacs-e077cc80af15ba30231f3e921389415c6a22a59d.zip
(code_convert_region): Delete text properties before shrinking the
conversion region.
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/coding.c b/src/coding.c
index b2a33c89cd1..17be6af296d 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -4718,6 +4718,7 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace)
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)
@@ -4726,6 +4727,14 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace)
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))
@@ -4842,17 +4851,6 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace)
4842 len -= total_skip; len_byte -= total_skip; 4851 len -= total_skip; len_byte -= total_skip;
4843 } 4852 }
4844 4853
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 }
4855
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.