From: Kim F. Storm Date: Wed, 13 Oct 2004 09:50:36 +0000 (+0000) Subject: (Fcall_process): Simplify handling of display arg. X-Git-Tag: ttn-vms-21-2-B4~4591 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0aa2630fac731241c383caa14eec3df5f93d6d94;p=emacs.git (Fcall_process): Simplify handling of display arg. Resume `display_on_the_fly' once a coding system is determined. --- diff --git a/src/callproc.c b/src/callproc.c index effd7ecbb14..5d7447d94f2 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -216,7 +216,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) int nargs; register Lisp_Object *args; { - Lisp_Object infile, buffer, current_dir, display, path; + Lisp_Object infile, buffer, current_dir, path; + int display_p; int fd[2]; int filefd; register int pid; @@ -372,7 +373,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) UNGCPRO; } - display = nargs >= 4 ? args[3] : Qnil; + display_p = INTERACTIVE && nargs >= 4 && !NILP (args[3]); filefd = emacs_open (SDATA (infile), O_RDONLY, 0); if (filefd < 0) @@ -747,7 +748,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) int first = 1; int total_read = 0; int carryover = 0; - int display_on_the_fly = !NILP (display) && INTERACTIVE; + int display_on_the_fly = display_p; struct coding_system saved_coding; int pt_orig = PT, pt_byte_orig = PT_BYTE; int inserted; @@ -823,12 +824,15 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) { /* 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. */ + done by insufficient data. So, we try the code + detection again with more data. */ xfree (decoding_buf); display_on_the_fly = 0; process_coding = saved_coding; carryover = nread; + /* This is to make the above condition always + fails in the future. */ + saved_coding.type = coding_type_no_conversion; continue; } @@ -929,12 +933,16 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) bufptr = tempptr; } - if (!NILP (display) && INTERACTIVE) + if (display_p) { if (first) prepare_menu_bars (); first = 0; redisplay_preserve_echo_area (1); + /* This variable might have been set to 0 for code + detection. In that case, we set it back to 1 because + we should have already detected a coding system. */ + display_on_the_fly = 1; } immediate_quit = 1; QUIT;