diff options
| -rw-r--r-- | etc/NEWS | 8 | ||||
| -rw-r--r-- | src/process.c | 19 |
2 files changed, 22 insertions, 5 deletions
| @@ -2724,6 +2724,14 @@ overlays. This is only done on 'display' properties that have the | |||
| 2724 | ** 'process-contact' now takes an optional NO-BLOCK argument to allow | 2724 | ** 'process-contact' now takes an optional NO-BLOCK argument to allow |
| 2725 | not waiting for a process to be set up. | 2725 | not waiting for a process to be set up. |
| 2726 | 2726 | ||
| 2727 | --- | ||
| 2728 | ** New variable 'read-process-output-max' controls sub-process throughput. | ||
| 2729 | This variable determines how many bytes can be read from a sub-process | ||
| 2730 | in one read operation. The default, 4096 bytes, was previously a | ||
| 2731 | hard-coded constant. Setting it to a larger value might enhance | ||
| 2732 | throughput of reading from sub-processes that produces vast | ||
| 2733 | (megabytes) amounts of data in one go. | ||
| 2734 | |||
| 2727 | +++ | 2735 | +++ |
| 2728 | ** The new user option 'quit-window-hook' is now run first when | 2736 | ** The new user option 'quit-window-hook' is now run first when |
| 2729 | executing the 'quit-window' command. | 2737 | executing the 'quit-window' command. |
diff --git a/src/process.c b/src/process.c index 0f82682ae5f..d6a0b30f7cb 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -6008,7 +6008,7 @@ read_and_dispose_of_process_output (struct Lisp_Process *p, char *chars, | |||
| 6008 | Yield number of decoded characters read, | 6008 | Yield number of decoded characters read, |
| 6009 | or -1 (setting errno) if there is a read error. | 6009 | or -1 (setting errno) if there is a read error. |
| 6010 | 6010 | ||
| 6011 | This function reads at most 4096 characters. | 6011 | This function reads at most read_process_output_max bytes. |
| 6012 | If you want to read all available subprocess output, | 6012 | If you want to read all available subprocess output, |
| 6013 | you must call it repeatedly until it returns zero. | 6013 | you must call it repeatedly until it returns zero. |
| 6014 | 6014 | ||
| @@ -6022,10 +6022,13 @@ read_process_output (Lisp_Object proc, int channel) | |||
| 6022 | struct Lisp_Process *p = XPROCESS (proc); | 6022 | struct Lisp_Process *p = XPROCESS (proc); |
| 6023 | struct coding_system *coding = proc_decode_coding_system[channel]; | 6023 | struct coding_system *coding = proc_decode_coding_system[channel]; |
| 6024 | int carryover = p->decoding_carryover; | 6024 | int carryover = p->decoding_carryover; |
| 6025 | enum { readmax = 4096 }; | 6025 | ptrdiff_t readmax = clip_to_bounds (1, read_process_output_max, PTRDIFF_MAX); |
| 6026 | ptrdiff_t count = SPECPDL_INDEX (); | 6026 | ptrdiff_t count = SPECPDL_INDEX (); |
| 6027 | Lisp_Object odeactivate; | 6027 | Lisp_Object odeactivate; |
| 6028 | char chars[sizeof coding->carryover + readmax]; | 6028 | char *chars; |
| 6029 | |||
| 6030 | USE_SAFE_ALLOCA; | ||
| 6031 | chars = SAFE_ALLOCA (sizeof coding->carryover + readmax); | ||
| 6029 | 6032 | ||
| 6030 | if (carryover) | 6033 | if (carryover) |
| 6031 | /* See the comment above. */ | 6034 | /* See the comment above. */ |
| @@ -6092,7 +6095,7 @@ read_process_output (Lisp_Object proc, int channel) | |||
| 6092 | if (nbytes <= 0) | 6095 | if (nbytes <= 0) |
| 6093 | { | 6096 | { |
| 6094 | if (nbytes < 0 || coding->mode & CODING_MODE_LAST_BLOCK) | 6097 | if (nbytes < 0 || coding->mode & CODING_MODE_LAST_BLOCK) |
| 6095 | return nbytes; | 6098 | return SAFE_FREE_UNBIND_TO (count, nbytes); |
| 6096 | coding->mode |= CODING_MODE_LAST_BLOCK; | 6099 | coding->mode |= CODING_MODE_LAST_BLOCK; |
| 6097 | } | 6100 | } |
| 6098 | 6101 | ||
| @@ -6116,7 +6119,7 @@ read_process_output (Lisp_Object proc, int channel) | |||
| 6116 | /* Handling the process output should not deactivate the mark. */ | 6119 | /* Handling the process output should not deactivate the mark. */ |
| 6117 | Vdeactivate_mark = odeactivate; | 6120 | Vdeactivate_mark = odeactivate; |
| 6118 | 6121 | ||
| 6119 | unbind_to (count, Qnil); | 6122 | SAFE_FREE_UNBIND_TO (count, Qnil); |
| 6120 | return nbytes; | 6123 | return nbytes; |
| 6121 | } | 6124 | } |
| 6122 | 6125 | ||
| @@ -8442,6 +8445,12 @@ returns non-`nil'. */); | |||
| 8442 | doc: /* Name of external socket passed to Emacs, or nil if none. */); | 8445 | doc: /* Name of external socket passed to Emacs, or nil if none. */); |
| 8443 | Vinternal__daemon_sockname = Qnil; | 8446 | Vinternal__daemon_sockname = Qnil; |
| 8444 | 8447 | ||
| 8448 | DEFVAR_INT ("read-process-output-max", read_process_output_max, | ||
| 8449 | doc: /* Maximum number of bytes to read from subprocess in a single chunk. | ||
| 8450 | Enlarge the value only if the subprocess generates very large (megabytes) | ||
| 8451 | amounts of data in one go. */); | ||
| 8452 | read_process_output_max = 4096; | ||
| 8453 | |||
| 8445 | DEFSYM (Qinternal_default_interrupt_process, | 8454 | DEFSYM (Qinternal_default_interrupt_process, |
| 8446 | "internal-default-interrupt-process"); | 8455 | "internal-default-interrupt-process"); |
| 8447 | DEFSYM (Qinterrupt_process_functions, "interrupt-process-functions"); | 8456 | DEFSYM (Qinterrupt_process_functions, "interrupt-process-functions"); |