Browse Source

* lisp/ob-clojure.el: Add more ClojureScript src block support.

* lisp/ob-clojure.el: Add ClojureScript src block tangle extension and
header arguments support.

* lisp/ob-clojure.el (org-babel-edit-prep:clojure): Auto inject src
block :ns header argument into editing temporary src block buffer local.

stardiviner 3 months ago
1 changed files with 9 additions and 0 deletions
  1. 9 0

+ 9 - 0

@@ -61,11 +61,15 @@
 (defvar org-babel-tangle-lang-exts)
 (add-to-list 'org-babel-tangle-lang-exts '("clojure" . "clj"))
+(add-to-list 'org-babel-tangle-lang-exts '("clojurescript" . "cljs"))
 (defvar org-babel-default-header-args:clojure '())
 (defvar org-babel-header-args:clojure '((ns . :any)
 					(package . :any)))
+(defvar org-babel-default-header-args:clojurescript '())
+(defvar org-babel-header-args:clojurescript '((package . :any)))
 (defcustom org-babel-clojure-sync-nrepl-timeout 10
   "Timeout value, in seconds, of a Clojure sync call.
 If the value is nil, timeout is disabled."
@@ -224,6 +228,11 @@ The underlying process performed by the code block can be output
 using the :show-process parameter."
   (org-babel-execute:clojure body (cons '(:target . "cljs") params)))
+(defun org-babel-edit-prep:clojure (babel-info)
+  "Set org-edit-special src block by injecting `cider-buffer-ns' as namespace."
+  (if-let* ((namespace (cdr (assq :ns (nth 2 babel-info)))))
+      (setq-local cider-buffer-ns namespace)))
 (defun org-babel-clojure-initiate-session (&optional session _params)
   "Initiate a session named SESSION according to PARAMS."
   (when (and session (not (string= session "none")))