diff options
| author | Kenichi Handa | 2008-05-28 06:38:47 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2008-05-28 06:38:47 +0000 |
| commit | 319a39470945e9bb166af6f131b68c23263b3bbe (patch) | |
| tree | 2ad15ed745094b12ebba85b38533806361dff085 /src/coding.c | |
| parent | 1ea1e2d498e7b8a692e21f6255085fa6fdbd3b23 (diff) | |
| download | emacs-319a39470945e9bb166af6f131b68c23263b3bbe.tar.gz emacs-319a39470945e9bb166af6f131b68c23263b3bbe.zip | |
(encode_coding_raw_text): Fix previous change.
(encode_coding_object): When the dst_object is a buffer and is
different from src_object, move gap to PT.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/coding.c b/src/coding.c index 91e8dd890b2..41b44556bd9 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -4881,7 +4881,7 @@ encode_coding_raw_text (coding) | |||
| 4881 | while (charbuf < charbuf_end && dst < dst_end) | 4881 | while (charbuf < charbuf_end && dst < dst_end) |
| 4882 | *dst++ = *charbuf++; | 4882 | *dst++ = *charbuf++; |
| 4883 | } | 4883 | } |
| 4884 | produced_chars = charbuf - coding->charbuf; | 4884 | produced_chars = dst - (coding->destination + coding->produced); |
| 4885 | } | 4885 | } |
| 4886 | record_conversion_result (coding, CODING_RESULT_SUCCESS); | 4886 | record_conversion_result (coding, CODING_RESULT_SUCCESS); |
| 4887 | coding->produced_char += produced_chars; | 4887 | coding->produced_char += produced_chars; |
| @@ -7331,8 +7331,13 @@ encode_coding_object (coding, src_object, from, from_byte, to, to_byte, | |||
| 7331 | } | 7331 | } |
| 7332 | else | 7332 | else |
| 7333 | { | 7333 | { |
| 7334 | coding->dst_pos = BUF_PT (XBUFFER (dst_object)); | 7334 | struct buffer *current = current_buffer; |
| 7335 | coding->dst_pos_byte = BUF_PT_BYTE (XBUFFER (dst_object)); | 7335 | |
| 7336 | set_buffer_temp (XBUFFER (dst_object)); | ||
| 7337 | coding->dst_pos = PT; | ||
| 7338 | coding->dst_pos_byte = PT_BYTE; | ||
| 7339 | move_gap_both (coding->dst_pos, coding->dst_pos_byte); | ||
| 7340 | set_buffer_temp (current); | ||
| 7336 | } | 7341 | } |
| 7337 | coding->dst_multibyte | 7342 | coding->dst_multibyte |
| 7338 | = ! NILP (XBUFFER (dst_object)->enable_multibyte_characters); | 7343 | = ! NILP (XBUFFER (dst_object)->enable_multibyte_characters); |
| @@ -8310,12 +8315,12 @@ START and END are buffer positions. | |||
| 8310 | Optional 4th arguments DESTINATION specifies where the decoded text goes. | 8315 | Optional 4th arguments DESTINATION specifies where the decoded text goes. |
| 8311 | If nil, the region between START and END is replaced by the decoded text. | 8316 | If nil, the region between START and END is replaced by the decoded text. |
| 8312 | If buffer, the decoded text is inserted in the buffer. | 8317 | If buffer, the decoded text is inserted in the buffer. |
| 8313 | If t, the decoded text is returned. | 8318 | In those cases, the length of the decoded text is returned.. |
| 8319 | If DESTINATION is t, the decoded text is returned. | ||
| 8314 | 8320 | ||
| 8315 | This function sets `last-coding-system-used' to the precise coding system | 8321 | This function sets `last-coding-system-used' to the precise coding system |
| 8316 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is | 8322 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is |
| 8317 | not fully specified.) | 8323 | not fully specified.) */) |
| 8318 | It returns the length of the decoded text. */) | ||
| 8319 | (start, end, coding_system, destination) | 8324 | (start, end, coding_system, destination) |
| 8320 | Lisp_Object start, end, coding_system, destination; | 8325 | Lisp_Object start, end, coding_system, destination; |
| 8321 | { | 8326 | { |
| @@ -8332,12 +8337,12 @@ START and END are buffer positions. | |||
| 8332 | Optional 4th arguments DESTINATION specifies where the encoded text goes. | 8337 | Optional 4th arguments DESTINATION specifies where the encoded text goes. |
| 8333 | If nil, the region between START and END is replace by the encoded text. | 8338 | If nil, the region between START and END is replace by the encoded text. |
| 8334 | If buffer, the encoded text is inserted in the buffer. | 8339 | If buffer, the encoded text is inserted in the buffer. |
| 8335 | If t, the encoded text is returned. | 8340 | In those cases, the length of the encoded text is returned.. |
| 8341 | If DESTINATION is t, the encoded text is returned. | ||
| 8336 | 8342 | ||
| 8337 | This function sets `last-coding-system-used' to the precise coding system | 8343 | This function sets `last-coding-system-used' to the precise coding system |
| 8338 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is | 8344 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is |
| 8339 | not fully specified.) | 8345 | not fully specified.) */) |
| 8340 | It returns the length of the encoded text. */) | ||
| 8341 | (start, end, coding_system, destination) | 8346 | (start, end, coding_system, destination) |
| 8342 | Lisp_Object start, end, coding_system, destination; | 8347 | Lisp_Object start, end, coding_system, destination; |
| 8343 | { | 8348 | { |
| @@ -8412,7 +8417,7 @@ if the decoding operation is trivial. | |||
| 8412 | 8417 | ||
| 8413 | Optional fourth arg BUFFER non-nil means that the decoded text is | 8418 | Optional fourth arg BUFFER non-nil means that the decoded text is |
| 8414 | inserted in BUFFER instead of returned as a string. In this case, | 8419 | inserted in BUFFER instead of returned as a string. In this case, |
| 8415 | the return value is BUFFER. | 8420 | the return value is the length of the decoded text. |
| 8416 | 8421 | ||
| 8417 | This function sets `last-coding-system-used' to the precise coding system | 8422 | This function sets `last-coding-system-used' to the precise coding system |
| 8418 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is | 8423 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is |
| @@ -8433,7 +8438,7 @@ itself if the encoding operation is trivial. | |||
| 8433 | 8438 | ||
| 8434 | Optional fourth arg BUFFER non-nil means that the encoded text is | 8439 | Optional fourth arg BUFFER non-nil means that the encoded text is |
| 8435 | inserted in BUFFER instead of returned as a string. In this case, | 8440 | inserted in BUFFER instead of returned as a string. In this case, |
| 8436 | the return value is BUFFER. | 8441 | the return value is the length of the encoded.text. |
| 8437 | 8442 | ||
| 8438 | This function sets `last-coding-system-used' to the precise coding system | 8443 | This function sets `last-coding-system-used' to the precise coding system |
| 8439 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is | 8444 | used (which may be different from CODING-SYSTEM if CODING-SYSTEM is |