aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.c
diff options
context:
space:
mode:
authorKenichi Handa2008-05-28 06:38:47 +0000
committerKenichi Handa2008-05-28 06:38:47 +0000
commit319a39470945e9bb166af6f131b68c23263b3bbe (patch)
tree2ad15ed745094b12ebba85b38533806361dff085 /src/coding.c
parent1ea1e2d498e7b8a692e21f6255085fa6fdbd3b23 (diff)
downloademacs-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.c27
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.
8310Optional 4th arguments DESTINATION specifies where the decoded text goes. 8315Optional 4th arguments DESTINATION specifies where the decoded text goes.
8311If nil, the region between START and END is replaced by the decoded text. 8316If nil, the region between START and END is replaced by the decoded text.
8312If buffer, the decoded text is inserted in the buffer. 8317If buffer, the decoded text is inserted in the buffer.
8313If t, the decoded text is returned. 8318In those cases, the length of the decoded text is returned..
8319If DESTINATION is t, the decoded text is returned.
8314 8320
8315This function sets `last-coding-system-used' to the precise coding system 8321This function sets `last-coding-system-used' to the precise coding system
8316used (which may be different from CODING-SYSTEM if CODING-SYSTEM is 8322used (which may be different from CODING-SYSTEM if CODING-SYSTEM is
8317not fully specified.) 8323not fully specified.) */)
8318It 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.
8332Optional 4th arguments DESTINATION specifies where the encoded text goes. 8337Optional 4th arguments DESTINATION specifies where the encoded text goes.
8333If nil, the region between START and END is replace by the encoded text. 8338If nil, the region between START and END is replace by the encoded text.
8334If buffer, the encoded text is inserted in the buffer. 8339If buffer, the encoded text is inserted in the buffer.
8335If t, the encoded text is returned. 8340In those cases, the length of the encoded text is returned..
8341If DESTINATION is t, the encoded text is returned.
8336 8342
8337This function sets `last-coding-system-used' to the precise coding system 8343This function sets `last-coding-system-used' to the precise coding system
8338used (which may be different from CODING-SYSTEM if CODING-SYSTEM is 8344used (which may be different from CODING-SYSTEM if CODING-SYSTEM is
8339not fully specified.) 8345not fully specified.) */)
8340It 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
8413Optional fourth arg BUFFER non-nil means that the decoded text is 8418Optional fourth arg BUFFER non-nil means that the decoded text is
8414inserted in BUFFER instead of returned as a string. In this case, 8419inserted in BUFFER instead of returned as a string. In this case,
8415the return value is BUFFER. 8420the return value is the length of the decoded text.
8416 8421
8417This function sets `last-coding-system-used' to the precise coding system 8422This function sets `last-coding-system-used' to the precise coding system
8418used (which may be different from CODING-SYSTEM if CODING-SYSTEM is 8423used (which may be different from CODING-SYSTEM if CODING-SYSTEM is
@@ -8433,7 +8438,7 @@ itself if the encoding operation is trivial.
8433 8438
8434Optional fourth arg BUFFER non-nil means that the encoded text is 8439Optional fourth arg BUFFER non-nil means that the encoded text is
8435inserted in BUFFER instead of returned as a string. In this case, 8440inserted in BUFFER instead of returned as a string. In this case,
8436the return value is BUFFER. 8441the return value is the length of the encoded.text.
8437 8442
8438This function sets `last-coding-system-used' to the precise coding system 8443This function sets `last-coding-system-used' to the precise coding system
8439used (which may be different from CODING-SYSTEM if CODING-SYSTEM is 8444used (which may be different from CODING-SYSTEM if CODING-SYSTEM is