branch: externals/ess
commit 71b0e364a1e8fe37e56c7783fd35c54c233e8137
Author: Lionel Henry <lionel....@gmail.com>
Commit: Lionel Henry <lionel....@gmail.com>

    Ask user to disable background evaluations in case of interrupt
---
 doc/newfeat.texi | 5 +++++
 lisp/ess-inf.el  | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/doc/newfeat.texi b/doc/newfeat.texi
index 4ee3961aad..e848cd0642 100644
--- a/doc/newfeat.texi
+++ b/doc/newfeat.texi
@@ -4,6 +4,11 @@
 Changes and New Features in 19.04 (unreleased):
 @itemize @bullet
 
+@item ESS[R]: When a background command is interrupted with C-g,
+ESS now asks the user if they want to disable background evaluations
+altogether. This is a resiliency measure against cases where background
+evals cause cascading errors or hangs.
+
 @item ESS[R]: Background commands now propagate errors to Emacs.
 
 @item ESS[R]: Background commands can now be disabled by process instad of 
globally.
diff --git a/lisp/ess-inf.el b/lisp/ess-inf.el
index b928c5dfcb..eb615296d8 100644
--- a/lisp/ess-inf.el
+++ b/lisp/ess-inf.el
@@ -1463,8 +1463,13 @@ wrapping the code into:
       (goto-char (point-max))
       (ess--interrupt proc)))
   ;; Can be `t` when early exit is caused e.g. by a throw instead of
-  ;; an error or a quit
+  ;; an error or a quit. This happens in tests and within
+  ;; `while-no-input'.
   (unless (eq early-exit t)
+    (when (and (eq (car early-exit) 'quit)
+               (y-or-n-p (concat "Background background command interrupted 
with a user quit.\n"
+                                 "Would you like to disable background 
evaluations in this process?")))
+      (process-put proc 'bg-eval-disabled t))
     (signal (car early-exit) (cdr early-exit))))
 
 ;; (ess-process-get 'ess-format-command-alist)

Reply via email to