summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-12-02 12:53:59 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2021-12-02 13:21:53 +0100
commita516ab79c300517d5c3ab68c45ff9c90bda6c67a (patch)
tree2826256a922fa007d285e6df03a1ac202a28ce48
parentd45e72fe5a9205b2e146d27e8e26233ee8518331 (diff)
downloademacs-a516ab79c300517d5c3ab68c45ff9c90bda6c67a.tar.gz
Add a new variable 'process-error-pause-time'
* doc/lispref/processes.texi (Asynchronous Processes): Document it. * lisp/cus-start.el (standard): Customize. * src/process.c (read_process_output_error_handler) (exec_sentinel_error_handler): Use it. (syms_of_process): New variable process-error-pause-time (bug#19457).
-rw-r--r--doc/lispref/processes.texi9
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/cus-start.el1
-rw-r--r--src/process.c12
4 files changed, 24 insertions, 2 deletions
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 8a9cb2a8f88..ac5d4d16277 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -966,6 +966,15 @@ use the function @code{process-tty-name} (@pxref{Process
Information}).
@end defvar
+@defvar process-error-pause-time
+If a process sentinel/filter function has an error, Emacs will (by
+default) pause Emacs for @code{process-error-pause-time} seconds after
+displaying this error, so that users will see the error in question.
+However, this can lead to situations where Emacs becomes unresponsive
+(if there's a lot of these errors happening), so this can be disabled
+by setting @code{process-error-pause-time} to 0.
+@end defvar
+
@node Deleting Processes
@section Deleting Processes
@cindex deleting processes
diff --git a/etc/NEWS b/etc/NEWS
index d783fc019cf..55733c6895d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -75,6 +75,10 @@ time.
* Changes in Emacs 29.1
+** New user option 'process-error-pause-time'.
+This determines how long to pause Emacs after a process
+filter/sentinel error has been handled.
+
+++
** New face 'variable-pitch-text'.
This face is like 'variable-pitch' (from which it inherits), but is
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 53cad99692c..579beae123f 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -575,6 +575,7 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
(ns-scroll-event-delta-factor ns float "29.1")
;; process.c
(delete-exited-processes processes-basics boolean)
+ (process-error-pause-time processes-basics integer "29.1")
;; syntax.c
(parse-sexp-ignore-comments editing-basics boolean)
(words-include-escapes editing-basics boolean)
diff --git a/src/process.c b/src/process.c
index 241ffe9a8dd..483da4d7e4f 100644
--- a/src/process.c
+++ b/src/process.c
@@ -5994,7 +5994,8 @@ read_process_output_error_handler (Lisp_Object error_val)
cmd_error_internal (error_val, "error in process filter: ");
Vinhibit_quit = Qt;
update_echo_area ();
- Fsleep_for (make_fixnum (2), Qnil);
+ if (process_error_pause_time > 0)
+ Fsleep_for (make_fixnum (process_error_pause_time), Qnil);
return Qt;
}
@@ -7421,7 +7422,8 @@ exec_sentinel_error_handler (Lisp_Object error_val)
cmd_error_internal (error_val, "error in process sentinel: ");
Vinhibit_quit = Qt;
update_echo_area ();
- Fsleep_for (make_fixnum (2), Qnil);
+ if (process_error_pause_time > 0)
+ Fsleep_for (make_fixnum (process_error_pause_time), Qnil);
return Qt;
}
@@ -8577,6 +8579,12 @@ Enlarge the value only if the subprocess generates very large (megabytes)
amounts of data in one go. */);
read_process_output_max = 4096;
+ DEFVAR_INT ("process-error-pause-time", process_error_pause_time,
+ doc: /* The number of seconds to pause after handling process errors.
+This isn't used for all process-related errors, but is used when a
+sentinel or a process filter function has an error. */);
+ process_error_pause_time = 1;
+
DEFSYM (Qinternal_default_interrupt_process,
"internal-default-interrupt-process");
DEFSYM (Qinterrupt_process_functions, "interrupt-process-functions");