[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] [PATCH 01/10] Fix org-babel-R-initiate-session
From: |
Aaron Ecay |
Subject: |
[O] [PATCH 01/10] Fix org-babel-R-initiate-session |
Date: |
Mon, 1 Apr 2013 01:42:15 -0400 |
* lisp/ob-R.el (org-babel-R-initiate-session): handle case where the
session buffer exists, but does not have a live process
If the session buffer exists, but the user has exited the R process
manually, then the (R) command will create a new buffer, then try to
rename it over the old buffer, causing an error. The right thing to do
is to start R within the existing buffer.
---
lisp/ob-R.el | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/lisp/ob-R.el b/lisp/ob-R.el
index 9875f81..de9ec5b 100644
--- a/lisp/ob-R.el
+++ b/lisp/ob-R.el
@@ -209,14 +209,18 @@ This function is called by `org-babel-execute-src-block'."
(if (org-babel-comint-buffer-livep session)
session
(save-window-excursion
- (require 'ess) (R)
- (rename-buffer
- (if (bufferp session)
- (buffer-name session)
- (if (stringp session)
- session
- (buffer-name))))
- (current-buffer))))))
+ (save-excursion
+ (when (get-buffer session)
+ ;; Session buffer exists, but with dead process
+ (set-buffer session))
+ (require 'ess) (R)
+ (rename-buffer
+ (if (bufferp session)
+ (buffer-name session)
+ (if (stringp session)
+ session
+ (buffer-name))))
+ (current-buffer)))))))
(defun org-babel-R-associate-session (session)
"Associate R code buffer with an R session.
--
1.8.2
[O] [PATCH 03/10] Clean up various org-babel-*-maybe commands, Aaron Ecay, 2013/04/01