From f8c437e5c3472ac9e50c85622db6de06c2d9b1ac Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Mon, 23 Feb 2009 17:52:18 -0800 Subject: [PATCH] ensuring return to current buffer when executing R code --- litorgy/litorgy-R.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/litorgy/litorgy-R.el b/litorgy/litorgy-R.el index 7dae49a23..5cfe26d4d 100644 --- a/litorgy/litorgy-R.el +++ b/litorgy/litorgy-R.el @@ -36,11 +36,12 @@ (defun litorgy-execute:R (body params) "Execute a block of R code with litorgy. This function is called by `litorgy-execute-src-block'." - (let (results) - (message "executing R code block...") - (litorgy-initiate-R-buffer) - (mapc (lambda (line) (litorgy-R-input-command line)) (butlast (split-string body "[\r\n]"))) - (litorgy-R-last-output))) + (save-window-excursion + (let (results) + (message "executing R code block...") + (litorgy-initiate-R-buffer) + (mapc (lambda (line) (litorgy-R-input-command line)) (butlast (split-string body "[\r\n]"))) + (litorgy-R-last-output)))) ;; Maybe the following be replaced with a method using `ess-execute', ;; I went with the following functions because I wrote them and they