From 83a1896bfe36d3f9c27c5499a32b8400bd16cc9d Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Fri, 19 Jan 2018 11:01:28 -0800 Subject: [PATCH] bind ess remote eval --- emacs_el/configuration/don-configuration.org | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/emacs_el/configuration/don-configuration.org b/emacs_el/configuration/don-configuration.org index a5a1035..de65daf 100644 --- a/emacs_el/configuration/don-configuration.org +++ b/emacs_el/configuration/don-configuration.org @@ -868,6 +868,10 @@ This can be used to link things pretty quickly if necessary #+BEGIN_SRC emacs-lisp (use-package ess :ensure t + :commands R + :mode "\\.R\\'" + :bind (:map ess-mode-map + ("C-c C-R" . dla/ess-region-remote-eval)) :config (defun ess-change-directory (path) "Set the current working directory to PATH for both *R* and Emacs." @@ -890,11 +894,11 @@ This can be used to link things pretty quickly if necessary ((looking-at "^[a-zA-Z0-9_\.]+ ?<- ?function(.*{") 3) (t 1000))) )) - (add-hook 'ess-mode-hook - '(lambda () - (local-set-key (kbd "C-c C-R") - 'dla/ess-region-remote-eval))) - + (defun dla/ess-region-remote-eval (start end) + "Evaluate region in a remote ESS instance" + (interactive "r") + (shell-command-on-region start end "eval_r" (get-buffer-create "***essregionremoteeval***")) + kill-buffer "***essregionremoteeval***") ;; Don't restore history or save workspace image '(inferior-R-args "--no-restore-history --no-save") ) -- 2.39.2