[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ess 27e5af801a 2/3: Clean up startup options command
From: |
ELPA Syncer |
Subject: |
[elpa] externals/ess 27e5af801a 2/3: Clean up startup options command |
Date: |
Tue, 4 Apr 2023 04:58:03 -0400 (EDT) |
branch: externals/ess
commit 27e5af801aa04c200905ce62cff14f0e5b6ab187
Author: Lionel Henry <lionel.hry@gmail.com>
Commit: Lionel Henry <lionel.hry@gmail.com>
Clean up startup options command
- Move everything to same place
- Don't rely on old S config
---
lisp/ess-r-mode.el | 32 +++++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/lisp/ess-r-mode.el b/lisp/ess-r-mode.el
index 664e9a1aaf..91558c8c54 100644
--- a/lisp/ess-r-mode.el
+++ b/lisp/ess-r-mode.el
@@ -655,15 +655,10 @@ Executed in process buffer."
(unless (ess-wait-for-process nil nil nil nil ess--r-init-timeout)
(error "Process is busy"))
(ess-r--without-format-command
- (ess-command (format
- "if (identical(getOption('pager'), file.path(R.home(),
'bin', 'pager')))
- options(pager = '%s')\n"
- inferior-ess-pager))
+ (ess-command (ess-r--init-options-command))
;; TODO: Detect early exits on the R side and communicate
;; them to lisp
- (ess-r-load-ESSR))
- (when inferior-ess-language-start
- (ess-command (concat inferior-ess-language-start "\n"))))
+ (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"))
(ess-execute-screen-options t)
@@ -674,6 +669,29 @@ Executed in process buffer."
(run-hooks 'ess-r-post-run-hook)
(ess-wait-for-process))
+;; FIXME: Should we stop setting `str.dendogram.last`? See:
+;;
https://emacs.stackexchange.com/questions/27673/ess-dendrograms-appearance-of-last-branch/27729#27729
+;;
+;; FIXME: We don't use `ess-r-pager`? It's nil by default and
+;; documented that this should not normally be set
+(defun ess-r--init-options-command ()
+ (let ((args (list (format "STERM = '%s'" ess-STERM)
+ "str.dendrogram.last = '\\''"
+ (format "editor = '%s'" ess-r-editor)
+ (ess-r--opt-if-unset "pager"
+ "file.path(R.home(), 'bin', 'pager')"
+ (format "'%s'" inferior-ess-pager))
+ "show.error.locations = TRUE")))
+ (format "options(%s)\n" (mapconcat 'identity args ", "))))
+
+(defun ess-r--opt-if-unset (opt default value)
+ (format "%s = if (identical(getOption('%s'), %s)) %s else %s"
+ opt
+ opt
+ default
+ value
+ default))
+
(defun ess-r--skip-function ()
;; Assumes the point is at function start
(if (looking-at-p ess-r-set-function-start)