From: Kenichi Handa Date: Thu, 7 May 1998 01:05:36 +0000 (+0000) Subject: (Fcall_process): If we must display received data on X-Git-Tag: emacs-20.3~1111 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7a7ab107f9e6973eaed124ce3a496fc65b51850e;p=emacs.git (Fcall_process): If we must display received data on the fly, don't wait until a buffer is filled. --- diff --git a/src/callproc.c b/src/callproc.c index 9fa852ef6f0..e35b8274b7c 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -633,13 +633,14 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") int first = 1; int total_read = 0; int carryover = 0; + int display_on_the_fly = !NILP (display) && INTERACTIVE; + struct coding_system saved_coding = process_coding; while (1) { /* Repeatedly read until we've filled as much as possible of the buffer size we have. But don't read less than 1024--save that for the next bufferful. */ - nread = carryover; while (nread < bufsize - 1024) { @@ -649,21 +650,20 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") goto give_up; if (this_read == 0) - goto give_up_1; + { + process_coding.mode |= CODING_MODE_LAST_BLOCK; + break; + } nread += this_read; - } + total_read += this_read; - give_up_1: + if (display_on_the_fly) + break; + } /* Now NREAD is the total amount of data in the buffer. */ - if (nread == carryover) - /* Here, just tell decode_coding that we are processing the - last block. We break the loop after decoding. */ - process_coding.mode |= CODING_MODE_LAST_BLOCK; - immediate_quit = 0; - total_read += nread - carryover; if (!NILP (buffer)) { @@ -676,6 +676,19 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") decode_coding (&process_coding, bufptr, decoding_buf, nread, size); + if (display_on_the_fly + && saved_coding.type == coding_type_undecided + && process_coding.type != coding_type_undecided) + { + /* We have detected some coding system. But, + there's a possibility that the detection was + done by insufficient data. So, we give up + displaying on the fly. */ + display_on_the_fly = 0; + process_coding = saved_coding; + carryover = nread; + continue; + } if (process_coding.produced > 0) insert (decoding_buf, process_coding.produced); carryover = nread - process_coding.consumed;