From 07407519d2e8de0f2925a9d2971b855fd0be86b4 Mon Sep 17 00:00:00 2001 Message-Id: <07407519d2e8de0f2925a9d2971b855fd0be86b4.1681814636.git.yantar92@posteo.net> From: Ihor Radchenko Date: Tue, 18 Apr 2023 12:42:29 +0200 Subject: [PATCH] ob-R: Fix regression after ESS commit 536b5b914a7 * lisp/ob-R.el (org-babel-R--set-wide-screen-width): New function setting fill column to large value in ESS interactive shell. (org-babel-R-initiate-session): Override the default ESS truncation settings. Reported-by: Ihor Radchenko Link: https://orgmode.org/list/87ilduqrem.fsf@localhost --- lisp/ob-R.el | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lisp/ob-R.el b/lisp/ob-R.el index 7ea137197..9ad878370 100644 --- a/lisp/ob-R.el +++ b/lisp/ob-R.el @@ -39,6 +39,10 @@ (declare-function orgtbl-to-tsv "org-table" (table params)) (declare-function run-ess-r "ext:ess-r-mode" (&optional start-args)) (declare-function inferior-ess-send-input "ext:ess-inf" ()) (declare-function ess-make-buffer-current "ext:ess-inf" ()) +(declare-function + ess-command "ext:ess-inf" + (cmd &optional out-buffer sleep no-prompt-check wait proc proc force-redisplay timeout)) +(declare-function ess-calculate-width "ext:ess-inf" (opt)) (declare-function ess-eval-buffer "ext:ess-inf" (vis)) (declare-function ess-wait-for-process "ext:ess-inf" (&optional proc sec-prompt wait force-redisplay)) @@ -261,7 +265,13 @@ (defun org-babel-R-assign-elisp (name value colnames-p rownames-p) (t (format "%s <- %S" name (prin1-to-string value)))))) +(defun org-babel-R--set-wide-screen-width () + "Set large screen width in current R buffer." + (org-require-package 'ess-inf "ESS") + (ess-command (ess-calculate-width 9999))) + (defvar ess-ask-for-ess-directory) ; dynamically scoped +(defvar ess-r-post-run-hook) (defun org-babel-R-initiate-session (session params) "If there is not a current R process then create one." (unless (string= session "none") @@ -277,7 +287,10 @@ (defun org-babel-R-initiate-session (session params) ;; Session buffer exists, but with dead process (set-buffer session)) (org-require-package 'ess-r-mode "ESS") - (set-buffer (run-ess-r)) + (let ((ess-r-post-run-hook + (cons #'org-babel-R--set-wide-screen-width + ess-r-post-run-hook))) + (set-buffer (run-ess-r))) (let ((R-proc (get-process (or ess-local-process-name ess-current-process-name)))) (while (process-get R-proc 'callbacks) -- 2.40.0