emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ess 2d6d543946 2/2: Preserve original error messages in


From: ELPA Syncer
Subject: [elpa] externals/ess 2d6d543946 2/2: Preserve original error messages in startup init handler
Date: Tue, 4 Apr 2023 05:58:30 -0400 (EDT)

branch: externals/ess
commit 2d6d543946ec959f1c860b28218dcdac8e35168d
Author: Lionel Henry <lionel.hry@gmail.com>
Commit: Lionel Henry <lionel.hry@gmail.com>

    Preserve original error messages in startup init handler
---
 lisp/ess-r-mode.el | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/lisp/ess-r-mode.el b/lisp/ess-r-mode.el
index ee1b7c2e69..244daa044a 100644
--- a/lisp/ess-r-mode.el
+++ b/lisp/ess-r-mode.el
@@ -650,7 +650,7 @@ to run `ess-r-initialize' again.")
   "This function is run after the first R prompt.
 Executed in process buffer."
   (interactive)
-  (ess--exit-protect
+  (condition-case err
       (progn
         (unless (ess-wait-for-process nil nil nil nil ess-r--init-timeout)
           (error "Process is busy"))
@@ -659,8 +659,8 @@ Executed in process buffer."
           ;; TODO: Detect early exits on the R side and communicate
           ;; them to lisp
           (ess-r-load-ESSR)))
-    (ess-write-to-dribble-buffer "Failed to start ESSR.")
-    (error "ESSR failed to start. Please call `ess-r-initialize' to recover"))
+    (error (ess-r--init-error-handler err))
+    (quit (ess-r--init-error-handler)))
   (ess-execute-screen-options t)
   (ess-set-working-directory default-directory)
   (when ess-use-tracebug
@@ -669,6 +669,15 @@ 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")
+  (let ((msgs `("ESSR failed to start, please call `ess-r-initialize' to 
recover"
+                ,@(when err
+                    (concat "Caused by error: " (error-message-string err))))))
+    (error (mapconcat 'identity msgs "\n"))))
+
 ;; FIXME: Should we stop setting `str.dendogram.last`? See:
 ;; 
https://emacs.stackexchange.com/questions/27673/ess-dendrograms-appearance-of-last-branch/27729#27729
 ;;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]