diff options
| author | Kenichi Handa | 1998-05-07 01:05:36 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1998-05-07 01:05:36 +0000 |
| commit | 7a7ab107f9e6973eaed124ce3a496fc65b51850e (patch) | |
| tree | 8756a7e39d0a7db1d53063eda569ac4b6982a43a /src | |
| parent | 32395fcf0663d79060f9c8026773bbe1a6b00e5b (diff) | |
| download | emacs-7a7ab107f9e6973eaed124ce3a496fc65b51850e.tar.gz emacs-7a7ab107f9e6973eaed124ce3a496fc65b51850e.zip | |
(Fcall_process): If we must display received data on
the fly, don't wait until a buffer is filled.
Diffstat (limited to 'src')
| -rw-r--r-- | src/callproc.c | 33 |
1 files changed, 23 insertions, 10 deletions
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.") | |||
| 633 | int first = 1; | 633 | int first = 1; |
| 634 | int total_read = 0; | 634 | int total_read = 0; |
| 635 | int carryover = 0; | 635 | int carryover = 0; |
| 636 | int display_on_the_fly = !NILP (display) && INTERACTIVE; | ||
| 637 | struct coding_system saved_coding = process_coding; | ||
| 636 | 638 | ||
| 637 | while (1) | 639 | while (1) |
| 638 | { | 640 | { |
| 639 | /* Repeatedly read until we've filled as much as possible | 641 | /* Repeatedly read until we've filled as much as possible |
| 640 | of the buffer size we have. But don't read | 642 | of the buffer size we have. But don't read |
| 641 | less than 1024--save that for the next bufferful. */ | 643 | less than 1024--save that for the next bufferful. */ |
| 642 | |||
| 643 | nread = carryover; | 644 | nread = carryover; |
| 644 | while (nread < bufsize - 1024) | 645 | while (nread < bufsize - 1024) |
| 645 | { | 646 | { |
| @@ -649,21 +650,20 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") | |||
| 649 | goto give_up; | 650 | goto give_up; |
| 650 | 651 | ||
| 651 | if (this_read == 0) | 652 | if (this_read == 0) |
| 652 | goto give_up_1; | 653 | { |
| 654 | process_coding.mode |= CODING_MODE_LAST_BLOCK; | ||
| 655 | break; | ||
| 656 | } | ||
| 653 | 657 | ||
| 654 | nread += this_read; | 658 | nread += this_read; |
| 655 | } | 659 | total_read += this_read; |
| 656 | 660 | ||
| 657 | give_up_1: | 661 | if (display_on_the_fly) |
| 662 | break; | ||
| 663 | } | ||
| 658 | 664 | ||
| 659 | /* Now NREAD is the total amount of data in the buffer. */ | 665 | /* Now NREAD is the total amount of data in the buffer. */ |
| 660 | if (nread == carryover) | ||
| 661 | /* Here, just tell decode_coding that we are processing the | ||
| 662 | last block. We break the loop after decoding. */ | ||
| 663 | process_coding.mode |= CODING_MODE_LAST_BLOCK; | ||
| 664 | |||
| 665 | immediate_quit = 0; | 666 | immediate_quit = 0; |
| 666 | total_read += nread - carryover; | ||
| 667 | 667 | ||
| 668 | if (!NILP (buffer)) | 668 | if (!NILP (buffer)) |
| 669 | { | 669 | { |
| @@ -676,6 +676,19 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") | |||
| 676 | 676 | ||
| 677 | decode_coding (&process_coding, bufptr, decoding_buf, | 677 | decode_coding (&process_coding, bufptr, decoding_buf, |
| 678 | nread, size); | 678 | nread, size); |
| 679 | if (display_on_the_fly | ||
| 680 | && saved_coding.type == coding_type_undecided | ||
| 681 | && process_coding.type != coding_type_undecided) | ||
| 682 | { | ||
| 683 | /* We have detected some coding system. But, | ||
| 684 | there's a possibility that the detection was | ||
| 685 | done by insufficient data. So, we give up | ||
| 686 | displaying on the fly. */ | ||
| 687 | display_on_the_fly = 0; | ||
| 688 | process_coding = saved_coding; | ||
| 689 | carryover = nread; | ||
| 690 | continue; | ||
| 691 | } | ||
| 679 | if (process_coding.produced > 0) | 692 | if (process_coding.produced > 0) |
| 680 | insert (decoding_buf, process_coding.produced); | 693 | insert (decoding_buf, process_coding.produced); |
| 681 | carryover = nread - process_coding.consumed; | 694 | carryover = nread - process_coding.consumed; |