diff options
| author | Kenichi Handa <handa@m17n.org> | 2000-07-19 03:44:55 +0000 |
|---|---|---|
| committer | Kenichi Handa <handa@m17n.org> | 2000-07-19 03:44:55 +0000 |
| commit | e077cc80af15ba30231f3e921389415c6a22a59d (patch) | |
| tree | d6d2119671d717c6db110c66437496c98c1e10b0 | |
| parent | 670acd6287b0482e1cf54cb44d3eaf93f3ca1405 (diff) | |
| download | emacs-e077cc80af15ba30231f3e921389415c6a22a59d.tar.gz | |
(code_convert_region): Delete text properties before shrinking the
conversion region.
| -rw-r--r-- | src/coding.c | 20 |
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) 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 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) 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 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) 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. |
