emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] ob-clojure and ob-clojure-literate support :ns header argume


From: stardiviner
Subject: [O] [PATCH] ob-clojure and ob-clojure-literate support :ns header argument [V1]
Date: Tue, 27 Mar 2018 11:02:03 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

This should be this finalize version patch.

The whole discussion is here: https://github.com/clojure-emacs/clojure-mode/pull/465

After test many case (all passed):

```org

#+begin_src clojure :results pp
;; (def greeting "hi there!")
*ns*
#+end_src

#+RESULTS[<2018-03-26 14:43:51> 2d1907bb790168e9429b9b07b4409d08ac8ca274]:
: #namespace[user]

Test internal ns in body.
# TODO: this has a weird behavior, the result changes, sometimes is #'kk.test/he, second time will be #'user/he
- [X] confirmed org-babel-expand-body:clojure is fine
- [X] check org-babel-execute:clojure

#+begin_src clojure :results pp
(ns kk.test)
(def he "hi")
#+end_src

#+RESULTS[<2018-03-26 12:52:06> fb9ad1efe68a43d880e53205f1326c000d1522d3]:
: #'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-03-26 19:26:24> 36ac1cb6a3df8b20edb0bf11c1247399bc041390]:
: (dict "status"
:       ("done" "state")
:       "id" "362" "out" "#'user/he\n" "session" "5ba759a7-a80a-4b02-a934-a0d7686ee211" "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-03-26 13:43:22> 0bfbd971f26d1f097d19dc0e3230decc31cc9e6e]:
: 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-03-26 12:53:27> 6c547cacff4e65305cc9f855117ca43ffd9d2eab]:
: 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:
: "hi"
: #namespace[kk]

```


On 03/26/2018 12:38 PM, stardiviner wrote:
Previous `ob-clojure.el` patch implement method is not good enough. Here is a better implementation.
Sorry for this over posting.


On 03/26/2018 09:59 AM, stardiviner wrote:

- support :ns header (as discussed at here https://github.com/clojure-emacs/clojure-mode/pull/465#discussion_r158009538)

- supoort inject CIDER outside of project

- support :var initialization when :session initialization prepare.


On 03/22/2018 01:49 AM, stardiviner wrote:

Two patches

One is to support ob-clojure.el future coming header argument :ns.

The second is to support jack-in CIDER outside of Clojure project by default. Not no need to ob-clojure project to be created anymore.




Attachment: 0001-ob-clojure-literate.el-CIDER-jack-in-outside-of-proj.patch
Description: Text Data

Attachment: 0002-ob-clojure-literate.el-support-use-ns-header-argumen.patch
Description: Text Data

Attachment: 0003-ob-clojure-literate.el-support-vars-initialization-w.patch
Description: Text Data

Attachment: 0004-ob-clojure.el-org-babel-execute-clojure-support-ns-h.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]