aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa <[email protected]>2000-10-25 11:06:51 +0000
committerKenichi Handa <[email protected]>2000-10-25 11:06:51 +0000
commita92e4183e850869f1ed37300f908dc81db2c9428 (patch)
tree13321ae89367d4cbd3610b778a6c38de8354f504
parent68c3a13776f80f103be2598072e75c98e39b3940 (diff)
(send_process): If OBJECT is t, it means that the data
is from C string, but we should encode it. Before calling setup_raw_text_coding_system, be sure to flush out data by the previous coding system.
-rw-r--r--src/process.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/process.c b/src/process.c
index b36fbc7910..cb51af92af 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3185,13 +3185,11 @@ send_process_trap ()
/* Send some data to process PROC.
BUF is the beginning of the data; LEN is the number of characters.
- OBJECT is the Lisp object that the data comes from.
+ OBJECT is the Lisp object that the data comes from. If OBJECT is
+ nil or t, it means that the data comes from C string.
- The data is encoded by PROC's coding-system for encoding before it
- is sent. But if the data ends at the middle of multi-byte
- representation, that incomplete sequence of bytes are sent without
- being encoded. Should we store them in a buffer to prepend them to
- the data send later?
+ If OBJECT is not nil, the data is encoded by PROC's coding-system
+ for encoding before it is sent.
This function can evaluate Lisp code and can garbage collect. */
@@ -3228,7 +3226,8 @@ send_process (proc, buf, len, object)
if ((STRINGP (object) && STRING_MULTIBYTE (object))
|| (BUFFERP (object)
- && !NILP (XBUFFER (object)->enable_multibyte_characters)))
+ && !NILP (XBUFFER (object)->enable_multibyte_characters))
+ || EQ (object, Qt))
{
coding->src_multibyte = 1;
if (!EQ (coding->symbol, XPROCESS (proc)->encode_coding_system))
@@ -3242,11 +3241,20 @@ send_process (proc, buf, len, object)
}
else
{
- coding->src_multibyte = 0;
- /* For sending a unibyte text, character code conversion
- should not take place but EOL conversion should. So, setup
- raw-text or one of the subsidiary. */
- setup_raw_text_coding_system (coding);
+ /* For sending a unibyte text, character code conversion should
+ not take place but EOL conversion should. So, setup raw-text
+ or one of the subsidiary if we have not yet done it. */
+ if (coding->type != coding_type_raw_text)
+ {
+ if (CODING_REQUIRE_FLUSHING (coding))
+ {
+ /* But, before changing the coding, we must flush out data. */
+ coding->mode |= CODING_MODE_LAST_BLOCK;
+ send_process (proc, "", 0, Qt);
+ }
+ coding->src_multibyte = 0;
+ setup_raw_text_coding_system (coding);
+ }
}
coding->dst_multibyte = 0;