|
| From: | stardiviner |
| Subject: | [O] [PATCH] ob-clojure.el and ob-clojure-literate.el support new header argument :ns |
| Date: | Fri, 13 Apr 2018 20:55:25 +0800 |
| User-agent: | mu4e 1.0; emacs 27.0.50 |
After about 5 times test, And about 4 times review. I decide to PR.
About new header argument :ns, I don't know how to write the test for it
with loading CIDER in ERT. So have not write test. But I load my patch
code, and run test on the following examples works fine.
#+begin_src clojure :results pp
;; (def greeting "hi there!")
*ns*
#+end_src
#+RESULTS[<2018-04-13 20:37:16> f6f68aecdefcfd1be88fb144d47f5881f47b95db]:
: #namespace[user]
#+begin_src clojure :results pp
(ns kk.test)
(def he "hi")
#+end_src
#+RESULTS[<2018-04-13 20:37:24> 0b564a90ba588ba72b622a217834057600ac6d07]:
: #'kk.test/he
Deeper testing:
#+begin_src emacs-lisp :results pp
(nrepl-sync-request:eval
"(clojure.pprint/pprint (do (ns user)\n (ns kk.test)\n (def he 2)))"
(cider-current-connection)
"user"
)
#+end_src
#+RESULTS[<2018-04-13 20:37:39> a05d9349d3b991a7fd47fb4ed268bf7e40f53e7a]:
: (dict "status"
: ("done" "state")
: "id" "20" "out" "#'user/he\n" "session"
"72ab6c95-08d4-4873-b83b-31c66aa26d62" "ns" "kk.test" "value" "nil"
"changed-namespaces"
: (dict)
: "repl-type" "clj")
#+begin_src clojure :results value :ns kk2
(def he "hi")
*ns*
#+end_src
#+RESULTS[<2018-04-13 20:38:09> 89b32544ad50101e9f6f529a9e87a7bb86235cd9]:
: nil#'kk2/he#namespace[kk2]
What about another src block without ~:ns~ specified after previous specified
src block?
#+begin_src clojure :results value
(def he "hi")
*ns*
#+end_src
#+RESULTS[<2018-04-13 20:38:14> 85a2890ea59d198e2d1c771e2b80b1ae6335c416]:
: nil#'user/he#namespace[user]
More complex example:
#+begin_src clojure :results output :var he="hi" :ns kk
;; (def he "hi")
(prn he)
(prn *ns*)
#+end_src
#+RESULTS[<2018-04-13 20:38:19> 9f6d74be8c54e2bc1b5047b569ddc6514c789cf0]:
: "hi"
: #namespace[kk]
0001-ob-clojure-literate.el-CIDER-jack-in-outside-of-proj.patch
Description: Text Data
0002-ob-clojure-literate.el-support-use-ns-header-argumen.patch
Description: Text Data
0003-ob-clojure-literate.el-support-vars-initialization-w.patch
Description: Text Data
0004-ob-clojure.el-org-babel-execute-clojure-support-ns-h.patch
Description: Text Data
0005-ob-clojure-literate.el-ob-clojure-literate-get-sessi.patch
Description: Text Data
0006-ob-clojure-literate.el-ob-clojure-literate-inject-co.patch
Description: Text Data
--
[ stardiviner ] don't need to convince with trends.
Blog: https://stardiviner.github.io/
IRC(freenode): stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
signature.asc
Description: PGP signature
| [Prev in Thread] | Current Thread | [Next in Thread] |