From mboxrd@z Thu Jan 1 00:00:00 1970 From: roberthambrock@gmail.com Subject: [PATCH 2/4] ob-clojure.el: Add ClojureScript interface Date: Sun, 22 Apr 2018 22:50:01 +0200 Message-ID: <20180422205003.87836-3-roberthambrock@gmail.com> References: <20180422205003.87836-1-roberthambrock@gmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fALwj-0003xV-9y for emacs-orgmode@gnu.org; Sun, 22 Apr 2018 16:50:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fALwi-0002sS-Ip for emacs-orgmode@gnu.org; Sun, 22 Apr 2018 16:50:53 -0400 Received: from mail-wr0-x22f.google.com ([2a00:1450:400c:c0c::22f]:45256) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fALwi-0002s8-C7 for emacs-orgmode@gnu.org; Sun, 22 Apr 2018 16:50:52 -0400 Received: by mail-wr0-x22f.google.com with SMTP id p5-v6so8007401wre.12 for ; Sun, 22 Apr 2018 13:50:52 -0700 (PDT) In-Reply-To: <20180422205003.87836-1-roberthambrock@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Cc: Robert Hambrock From: Robert Hambrock * lisp/ob-clojure.el (org-babel-execute:clojure): Implemented :target, which allows selection of connection. * lisp/ob-clojure.el (org-babel-execute:clojurescript): New ClojureScript interface that uses :target flag to specify `cljs` evaluation target. --- lisp/ob-clojure.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el index 93674b552..7f7c24ff1 100644 --- a/lisp/ob-clojure.el +++ b/lisp/ob-clojure.el @@ -129,7 +129,8 @@ using the :show-process parameter." (cider (require 'cider) (let ((result-params (cdr (assq :result-params params))) - (show (cdr (assq :show-process params)))) + (show (cdr (assq :show-process params))) + (connection (cider-current-connection (cdr (assq :target params))))) (if (member show '(nil "no")) ;; Run code without showing the process. (progn @@ -137,7 +138,7 @@ using the :show-process parameter." (let ((nrepl-sync-request-timeout org-babel-clojure-sync-nrepl-timeout)) (nrepl-sync-request:eval expanded - (cider-current-connection)))) + connection))) (setq result (concat (nrepl-dict-get response @@ -171,7 +172,7 @@ using the :show-process parameter." (nrepl--merge response resp) ;; Update the status of the nREPL output session. (setq status (nrepl-dict-get response "status"))) - (cider-current-connection)) + connection) ;; Wait until the nREPL code finished to be processed. (while (not (member "done" status)) @@ -211,6 +212,9 @@ using the :show-process parameter." (condition-case nil (org-babel-script-escape result) (error result))))) +(defun org-babel-execute:clojurescript (body params) + (org-babel-execute:clojure body (cons '(:target . "cljs") params))) + (provide 'ob-clojure) ;;; ob-clojure.el ends here -- 2.16.3