changeset 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 86c821099ed8
children a0e2fa7d8bb7
files src/coding.c
diffstat 1 files changed, 9 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/coding.c	Wed Jul 19 03:44:17 2000 +0000
+++ b/src/coding.c	Wed Jul 19 03:44:55 2000 +0000
@@ -4718,6 +4718,7 @@
   if (replace)
     {
       int saved_from = from;
+      int saved_inhibit_modification_hooks;
 
       prepare_to_modify_buffer (from, to, &from);
       if (saved_from != from)
@@ -4726,6 +4727,14 @@
 	  from_byte = CHAR_TO_BYTE (from), to_byte = CHAR_TO_BYTE (to);
 	  len_byte = to_byte - from_byte;
 	}
+
+      /* The code conversion routine can not preserve text properties
+	 for now.  So, we must remove all text properties in the
+	 region.  Here, we must suppress all modification hooks.  */
+      saved_inhibit_modification_hooks = inhibit_modification_hooks;
+      inhibit_modification_hooks = 1;
+      Fset_text_properties (make_number (from), make_number (to), Qnil, Qnil);
+      inhibit_modification_hooks = saved_inhibit_modification_hooks;
     }
 
   if (! encodep && CODING_REQUIRE_DETECTION (coding))
@@ -4842,17 +4851,6 @@
       len -= total_skip; len_byte -= total_skip;
     }
 
-  /* The code conversion routine can not preserve text properties for
-     now.  So, we must remove all text properties in the region.
-     Here, we must suppress all modification hooks.  */
-  if (replace)
-    {
-      int saved_inhibit_modification_hooks = inhibit_modification_hooks;
-      inhibit_modification_hooks = 1;
-      Fset_text_properties (make_number (from), make_number (to), Qnil, Qnil);
-      inhibit_modification_hooks = saved_inhibit_modification_hooks;
-    }
-
   /* For converion, we must put the gap before the text in addition to
      making the gap larger for efficient decoding.  The required gap
      size starts from 2000 which is the magic number used in make_gap.