emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: roberthambrock@gmail.com
To: emacs-orgmode@gnu.org
Cc: Robert Hambrock <roberthambrock@gmail.com>
Subject: [PATCH 2/4] ob-clojure.el: Add ClojureScript interface
Date: Sun, 22 Apr 2018 22:50:01 +0200	[thread overview]
Message-ID: <20180422205003.87836-3-roberthambrock@gmail.com> (raw)
In-Reply-To: <20180422205003.87836-1-roberthambrock@gmail.com>

From: Robert Hambrock <roberthambrock@gmail.com>

* 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

  parent reply	other threads:[~2018-04-22 20:50 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-22 20:49 [PATCH 0/4] Clojure mode patches roberthambrock
2018-04-22 20:50 ` [PATCH 1/4] org-src.el: Fixed dynamic fontification bug roberthambrock
2018-04-23  9:23   ` Nicolas Goaziou
2018-04-22 20:50 ` roberthambrock [this message]
2018-04-23  2:45   ` [PATCH 2/4] ob-clojure.el: Add ClojureScript interface stardiviner
2018-04-23  9:24   ` Nicolas Goaziou
2018-04-29 14:47   ` stardiviner
2018-10-25  6:11   ` stardiviner
2020-02-12 13:16   ` stardiviner
2020-02-12 17:09     ` Bastien
     [not found]       ` <87y2t6fqwj.fsf@gmail.com>
2020-02-13 16:04         ` [PATCH] " Bastien
2020-02-14  5:14           ` stardiviner
2020-02-14 10:02             ` Bastien
2020-02-14 15:17               ` stardiviner
2020-02-14  5:24           ` stardiviner
2020-02-14 10:02             ` Bastien
2020-02-14 15:15               ` stardiviner
2020-02-14 20:40                 ` Bastien
2020-02-15  0:42                   ` Tim Cross
2020-02-16 23:17                     ` Bastien
2020-02-16 23:33                       ` Tim Cross
2020-02-16 23:51                         ` Bastien
2020-04-28  9:29                       ` [BUG] ob-clojure.el new backend 'inf-clojure not compatible with latest version inf-clojure stardiviner
2020-05-22 15:12                         ` Bastien
2020-02-18 13:01                   ` [PATCH] Re: ob-clojure.el: Add ClojureScript interface stardiviner
2020-02-18 13:15                     ` Bastien
2020-02-19 15:51                       ` stardiviner
2018-04-22 20:50 ` [PATCH 3/4] ob-clojure.el: Use :ns flag in org-src-edit roberthambrock
2018-04-23  9:26   ` Nicolas Goaziou
2018-04-29 14:47   ` stardiviner
2018-04-22 20:50 ` [PATCH 4/4] ob-clojure.el: Add ClojureScript tangle language extension roberthambrock
2018-04-23  9:28   ` Nicolas Goaziou
2018-04-23  9:29 ` [PATCH 0/4] Clojure mode patches Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180422205003.87836-3-roberthambrock@gmail.com \
    --to=roberthambrock@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).