Mercurial > emacs
changeset 23514:7bad909cd6f1
(setup_coding_system): Fix setting up
coding->spec.ccl.valid_codes for CCL based coding system.
(code_convert_region): Set point to FROM before inserting the
result of pre-write-funciton. Preserve original point.
(code_convert_string): If coding->type is coding_type_ccl, do
conversion even if the length of conversion region is zero.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 21 Oct 1998 11:50:56 +0000 |
parents | 0a3fa36b323b |
children | 1e52542fb338 |
files | src/coding.c |
diffstat | 1 files changed, 30 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/coding.c Wed Oct 21 09:02:47 1998 +0000 +++ b/src/coding.c Wed Oct 21 11:50:56 1998 +0000 @@ -3138,7 +3138,7 @@ int end = XINT (XCONS (this)->cdr); if (start >= 0 && start <= end && end < 256) - while (start < end) + while (start <= end) coding->spec.ccl.valid_codes[start++] = 1; } } @@ -4169,12 +4169,16 @@ int fake_multibyte = 0; unsigned char *src, *dst; Lisp_Object deletion; + int orig_point = PT, orig_len = len; deletion = Qnil; saved_coding_symbol = Qnil; if (from < PT && PT < to) - SET_PT_BOTH (from, from_byte); + { + TEMP_SET_PT_BOTH (from, from_byte); + orig_point = from; + } if (replace) { @@ -4269,10 +4273,18 @@ new = current_buffer; set_buffer_internal_1 (prev); del_range_2 (from, from_byte, to, to_byte); - insert_from_buffer (new, BEG, len, 0); + TEMP_SET_PT_BOTH (from, from_byte); + insert_from_buffer (new, 1, len, 0); + if (orig_point >= to) + orig_point += len - orig_len; + else if (orig_point > from) + orig_point = from; + orig_len = len; to = from + len; + from_byte = multibyte ? CHAR_TO_BYTE (from) : from_byte; to_byte = multibyte ? CHAR_TO_BYTE (to) : to; len_byte = to_byte - from_byte; + TEMP_SET_PT_BOTH (from, from_byte); } } @@ -4516,18 +4528,24 @@ if (! encodep && ! NILP (coding->post_read_conversion)) { Lisp_Object val; - int orig_inserted = inserted, pos = PT; - - if (from != pos) - temp_set_point_both (current_buffer, from, from_byte); + + if (from != PT) + TEMP_SET_PT_BOTH (from, from_byte); val = call1 (coding->post_read_conversion, make_number (inserted)); if (! NILP (val)) { CHECK_NUMBER (val, 0); inserted = XFASTINT (val); } - if (pos >= from + orig_inserted) - temp_set_point (current_buffer, pos + (inserted - orig_inserted)); + } + + if (orig_point >= from) + { + if (orig_point >= from + orig_len) + orig_point += inserted - orig_len; + else + orig_point = from; + TEMP_SET_PT (orig_point); } signal_after_change (from, to - from, inserted); @@ -4565,7 +4583,7 @@ code_convert_region. */ int count = specpdl_ptr - specpdl; struct buffer *prev = current_buffer; - + record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); temp_output_buffer_setup (" *code-converting-work*"); set_buffer_internal (XBUFFER (Vstandard_output)); @@ -4619,7 +4637,8 @@ SHRINK_CONVERSION_REGION (&from, &to_byte, coding, XSTRING (str)->data, encodep); } - if (from == to_byte) + if (from == to_byte + && coding->type != coding_type_ccl) return (nocopy ? str : Fcopy_sequence (str)); if (encodep)