>From 2cdf05cf2fe3e0740997d9861c8ff8f81c163750 Mon Sep 17 00:00:00 2001 From: stardiviner Date: Fri, 9 Mar 2018 00:10:54 +0800 Subject: [PATCH 3/3] * ob-js.el: add :session support with js-comint. --- lisp/ob-js.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/ob-js.el b/lisp/ob-js.el index d2fc5e29c..126685813 100644 --- a/lisp/ob-js.el +++ b/lisp/ob-js.el @@ -59,6 +59,7 @@ :version "24.1" :type '(choice (const "node") (const "mozrepl") + (const "js-comint") (const "skewer-mode")) :safe #'stringp) @@ -159,7 +160,17 @@ specifying a variable of the same value." then create. Return the initialized session." (unless (string= session "none") (cond - ((string= "*skewer-repl*" session) + ((and (string= "js-comint" org-babel-js-cmd) ; `js-comint' + (string= "*Javascript REPL*" session)) + (require 'js-comint) + (let ((session-buffer "*Javascript REPL*")) + (if (and (org-babel-comint-buffer-livep (get-buffer session-buffer)) + (comint-check-proc session-buffer)) + session-buffer + (call-interactively 'run-js) + (sit-for .5) + session-buffer))) + ((string= "*skewer-repl*" session) ; `skewer-mode' (require 'skewer-repl) (let ((session-buffer (get-buffer "*skewer-repl*"))) (if (and (org-babel-comint-buffer-livep (get-buffer session-buffer)) -- 2.16.2