diff options
author | stardiviner <numbchild@gmail.com> | 2018-03-18 01:33:12 +0800 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2018-03-25 22:47:03 +0200 |
commit | 5ee6c459531b7d010b9825eab38822dec00e02d2 (patch) | |
tree | 71d0f98f384d095170116ec733c5992cb4ef521f | |
parent | b4e2fed77e1b656141bf4283b4b674e7e7fe895a (diff) | |
download | org-mode-5ee6c459531b7d010b9825eab38822dec00e02d2.tar.gz |
ob-js: support :session for js-comint REPL.
* lisp/ob-js.el (org-babel-js-cmd): Add js-comint.
(org-babel-js-initiate-session): Add support for js-comint.
-rw-r--r-- | etc/ORG-NEWS | 4 | ||||
-rw-r--r-- | lisp/ob-js.el | 12 |
2 files changed, 15 insertions, 1 deletions
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 1e5e4e4..d479b98 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -113,6 +113,10 @@ now sort according to the locale’s collation rules instead of by code-point. ** New features +*** Add ~:session~ support of ob-js for js-comint +#+begin_src js :session "*Javascript REPL*" +console.log("stardiviner") +#+end_src *** Add ~:session~ support of ob-js for Indium #+begin_src js :session "*JS REPL*" console.log("stardiviner") diff --git a/lisp/ob-js.el b/lisp/ob-js.el index 2794c71..f55960f 100644 --- a/lisp/ob-js.el +++ b/lisp/ob-js.el @@ -59,7 +59,8 @@ :type '(choice (const "node") (const "mozrepl") (const "skewer-mode") - (const "indium")) + (const "indium") + (const "js-comint")) :safe #'stringp) (defvar org-babel-js-function-wrapper @@ -169,6 +170,15 @@ then create. Return the initialized session." (httpd-start) (run-skewer) session-buffer))) + ((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= "mozrepl" org-babel-js-cmd) (require 'moz) (let ((session-buffer (save-window-excursion |