From 81175769d80f9a4f35c1ac406ce4820d7e8aefe7 Mon Sep 17 00:00:00 2001 From: charje Date: Mon, 27 Jan 2020 12:13:12 -0600 Subject: [PATCH 1/3] Add ess-compile-r-html function. I also added it to the mode line menu under ESS/Compile --- lisp/ess-mode.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lisp/ess-mode.el b/lisp/ess-mode.el index c8ac1cc68..bc2c2ff7b 100644 --- a/lisp/ess-mode.el +++ b/lisp/ess-mode.el @@ -162,6 +162,8 @@ :filter ess--generate-eval-visibly-submenu) ["Quit process" ess-quit t] ["Reload process" inferior-ess-reload t]) + ("Compile" + ["HTML" ess-compile-r-html t]) "------" ("ESS Eval" ["Eval region | func | para" ess-eval-region-or-function-or-paragraph t] @@ -334,6 +336,11 @@ With UPDATE, update cached package list." (when update (message "Don't know how to update for %s" ess-dialect)) (error "Cannot install %s, not available for %s" package ess-dialect)) +(defun ess-compile-r-html () + "Export the current R buffer as a buffer as an HTML template." + (interactive) + (print + (shell-command-to-string (concat "R --slave -e \"rmarkdown::render('" (buffer-file-name (current-buffer)) "')\"")))) ;; Motion / manipulation commands From 372efa36efe7c5f3b1d69c905d1b23d43f2cb607 Mon Sep 17 00:00:00 2001 From: charje Date: Mon, 27 Jan 2020 12:15:57 -0600 Subject: [PATCH 2/3] Change ess-compile-r-html to use (compile) --- lisp/ess-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/ess-mode.el b/lisp/ess-mode.el index bc2c2ff7b..e92d305bd 100644 --- a/lisp/ess-mode.el +++ b/lisp/ess-mode.el @@ -339,8 +339,8 @@ With UPDATE, update cached package list." (defun ess-compile-r-html () "Export the current R buffer as a buffer as an HTML template." (interactive) - (print - (shell-command-to-string (concat "R --slave -e \"rmarkdown::render('" (buffer-file-name (current-buffer)) "')\"")))) + (compile + (concat "R --slave -e \"rmarkdown::render('" (buffer-file-name (current-buffer)) "')\""))) ;; Motion / manipulation commands From 21c2d043fdf8f401dd0abc1d75d463e5e313efde Mon Sep 17 00:00:00 2001 From: charje Date: Mon, 27 Jan 2020 12:17:35 -0600 Subject: [PATCH 3/3] Fix typo in comment --- lisp/ess-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ess-mode.el b/lisp/ess-mode.el index e92d305bd..0d308d663 100644 --- a/lisp/ess-mode.el +++ b/lisp/ess-mode.el @@ -337,7 +337,7 @@ With UPDATE, update cached package list." (error "Cannot install %s, not available for %s" package ess-dialect)) (defun ess-compile-r-html () - "Export the current R buffer as a buffer as an HTML template." + "Export the current R buffer as an HTML template." (interactive) (compile (concat "R --slave -e \"rmarkdown::render('" (buffer-file-name (current-buffer)) "')\"")))