branch: externals/ess commit 47875fe1ac0ad8d0fc71539bc69aae9ecca1f514 Author: Lionel Henry <lionel....@gmail.com> Commit: Lionel Henry <lionel....@gmail.com>
Disable background commands when ESSR failed to load --- doc/newfeat.texi | 5 +++++ lisp/ess-r-mode.el | 5 +++-- test/ess-test-r.el | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/newfeat.texi b/doc/newfeat.texi index 54315c7580..e483d01d40 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]: Background commands can now be disabled by process instad of globally. +For instance when a process has failed to initialize properly, +background evals are disabled for that particular process to avoid +cascading errors. Other processes may still use background commands. + @item ESS[R]: ESSR commands are now more robust when ESSR is not in scope. This can happen when using @code{browser()} in an environment that doesn't inherit from the search path. diff --git a/lisp/ess-r-mode.el b/lisp/ess-r-mode.el index 6a638328b4..704641b9dc 100644 --- a/lisp/ess-r-mode.el +++ b/lisp/ess-r-mode.el @@ -669,10 +669,11 @@ Executed in process buffer." (run-hooks 'ess-r-post-run-hook) (ess-wait-for-process)) -;; TODO: Disable `ess-can-eval-in-background' in the process that -;; failed to start to prevent cascading errors (defun ess-r--init-error-handler (&optional err) (ess-write-to-dribble-buffer "Failed to start ESSR\n") + (when-let ((proc (and ess-local-process-name + (get-process ess-local-process-name)))) + (process-put proc 'bg-eval-disabled t)) (let ((msgs `("ESSR failed to start, please call `ess-r-initialize' to recover" ,@(when err (concat "Caused by error: " (error-message-string err)))))) diff --git a/test/ess-test-r.el b/test/ess-test-r.el index cb5896c0a3..b918ec49a5 100644 --- a/test/ess-test-r.el +++ b/test/ess-test-r.el @@ -903,6 +903,11 @@ https://github.com/emacs-ess/ESS/issues/725#issuecomment-431781558" (should (file-exists-p essr-path)) (ess--essr-load-or-throw-error remote-file-path #'ess-r--fetch-ESSR-remote))) +(ert-deftest ess-r-failed-init-disable-bg-eval-test () + (with-r-running nil + (should-error (ess-r--init-error-handler)) + (should (not (ess-can-eval-in-background))))) + (provide 'ess-test-r)