From mboxrd@z Thu Jan 1 00:00:00 1970 From: "numbchild@gmail.com" Subject: Re: ob-clojure evaluate error when Org-mode buffer has ns clojure code Date: Sat, 17 Jun 2017 21:26:47 +0800 Message-ID: References: <87zid7bd46.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="f403045f581a5e1b29055227dc66" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dMDl5-0008AM-A6 for emacs-orgmode@gnu.org; Sat, 17 Jun 2017 09:27:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dMDl1-0001Ah-I6 for emacs-orgmode@gnu.org; Sat, 17 Jun 2017 09:27:23 -0400 Received: from mail-wr0-x22e.google.com ([2a00:1450:400c:c0c::22e]:35790) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dMDl1-00018g-0S for emacs-orgmode@gnu.org; Sat, 17 Jun 2017 09:27:19 -0400 Received: by mail-wr0-x22e.google.com with SMTP id y25so11383633wrd.2 for ; Sat, 17 Jun 2017 06:27:18 -0700 (PDT) In-Reply-To: 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: Tim Cross Cc: Org-mode --f403045f581a5e1b29055227dc66 Content-Type: text/plain; charset="UTF-8" After a new evaluation. I found ```org #+BEGIN_SRC clojure (ns user (:require '[incanter.core :as mm])) #+END_SRC #+RESULTS: : class clojure.lang.Compiler$CompilerExceptionclass clojure.lang.Compiler$CompilerExceptionCompilerException java.lang.Exception: Found lib name 'incanter.core' containing period with prefix 'quote'. lib names inside prefix lists must not contain periods, compiling:(/home/stardiviner/Code/learning/Emacs/Org-mode/ob-clojure.org:1 :1) #+BEGIN_SRC clojure :session :results output (print "hi") (def kkkk "hello") #+END_SRC #+RESULTS: : hi ``` Both two src blocks works. Because the first src block Clojure namespace `(ns user ..)` is same with CIDER REPL default namespace `user`. So it works. But when I tried add header argument `:eval no` on first src block like this: ```org #+BEGIN_SRC clojure :session :eval no (ns user.kk (:require '[incanter.core :as mm])) #+END_SRC #+RESULTS: #+BEGIN_SRC clojure :session :results output (print "hi") (def kkkk "hello") #+END_SRC #+RESULTS: ``` The second src block failed again. So I think `ob-clojure` will try to evaluate the first src block even I added header argument `:eval no`. So `ob-clojure.el` does not respect header argument `:eval no`. But I think might because `:eval no` is not work for this purpose. I did can't evaluate by pressing `[C-c C-c]` on first block. [stardiviner] GPG key ID: 47C32433 IRC(freeenode): stardiviner Twitter: @numbchild Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 Blog: http://stardiviner.github.io/ On Sat, Jun 17, 2017 at 8:57 PM, numbchild@gmail.com wrote: > I did configure `ob-clojure` with the following settings: > > ```elisp > (require 'ob-clojure) > > ;; use CIDER as the Clojure execution backend > (setq org-babel-clojure-backend 'cider) > > ;; Useful keybindings when using Clojure from Org > ;; (org-defkey org-mode-map (kbd "C-x C-e") 'cider-eval-last-sexp) > ;; (org-defkey org-mode-map (kbd "C-c C-d") 'cider-doc) > > ;; No timeout when executing calls on Cider via nrepl > ;; (setq org-babel-clojure-sync-nrepl-timeout nil) > > ;; let `ob-clojure' babel src blocks allow evaluation. > (add-to-list 'org-babel-default-header-args:clojure > '(:eval . "yes")) > (add-to-list 'org-babel-default-header-args:clojure > '(:results . "output")) > ;; (add-to-list 'org-babel-default-header-args:clojure > ;; '(:show-process . t)) > ``` > > I start CIDER REPL session with `cider-jack-in` without project in Emacs. > > I changed namespace to `user` in src blocks like this: > > ```org > #+BEGIN_SRC clojure > (ns user > (:require '[incanter.core :as kk])) > #+END_SRC > > #+RESULTS: > > #+BEGIN_SRC clojure :session :results output > (print "hi") > (def kkkk "hello") > #+END_SRC > > #+RESULTS: > : hi > ``` > > Then it works. > > Seems you're right, might my first src block can't work correctly. That > caused second src block evaluation failed. > > But I require `incanter` works, I have `incanter` in Leiningen > dependencies. > ```clojure > (require '[incanter.core :as kk]) > ``` > > But include `incanter` in namespace failed: > ```clojure > (ns user > (:require '[incanter.core :as kk])) > ``` > with the following error. > ``` > Show: Clojure Java REPL Tooling Duplicates All (29 frames hidden) > > 2. Unhandled clojure.lang.Compiler$CompilerException > Error compiling Code/learning/Emacs/Org-mode/ob-clojure.org at (1:1) > > core.clj: 5771 clojure.core/throw-if > core.clj: 5835 clojure.core/load-lib > core.clj: 5832 clojure.core/load-lib > RestFn.java: 142 clojure.lang.RestFn/applyTo > core.clj: 659 clojure.core/apply > core.clj: 5893 clojure.core/load-libs > core.clj: 5873 clojure.core/load-libs > RestFn.java: 137 clojure.lang.RestFn/applyTo > core.clj: 659 clojure.core/apply > core.clj: 5911 clojure.core/require > core.clj: 5911 clojure.core/require > RestFn.java: 408 clojure.lang.RestFn/invoke > REPL: 1 user/eval46259/loading--auto-- > REPL: 1 user/eval46259 > REPL: 1 user/eval46259 > Compiler.java: 6977 clojure.lang.Compiler/eval > Compiler.java: 6966 clojure.lang.Compiler/eval > Compiler.java: 6940 clojure.lang.Compiler/eval > core.clj: 3187 clojure.core/eval > core.clj: 3183 clojure.core/eval > main.clj: 242 clojure.main/repl/read-eval-print/fn > main.clj: 242 clojure.main/repl/read-eval-print > main.clj: 260 clojure.main/repl/fn > main.clj: 260 clojure.main/repl > main.clj: 176 clojure.main/repl > RestFn.java: 1523 clojure.lang.RestFn/invoke > interruptible_eval.clj: 87 clojure.tools.nrepl. > middleware.interruptible-eval/evaluate/fn > AFn.java: 152 clojure.lang.AFn/applyToHelper > AFn.java: 144 clojure.lang.AFn/applyTo > core.clj: 657 clojure.core/apply > core.clj: 1963 clojure.core/with-bindings* > core.clj: 1963 clojure.core/with-bindings* > RestFn.java: 425 clojure.lang.RestFn/invoke > interruptible_eval.clj: 85 clojure.tools.nrepl. > middleware.interruptible-eval/evaluate > interruptible_eval.clj: 55 clojure.tools.nrepl. > middleware.interruptible-eval/evaluate > interruptible_eval.clj: 222 clojure.tools.nrepl. > middleware.interruptible-eval/interruptible-eval/fn/fn > interruptible_eval.clj: 190 clojure.tools.nrepl. > middleware.interruptible-eval/run-next/fn > AFn.java: 22 clojure.lang.AFn/run > ThreadPoolExecutor.java: 1142 java.util.concurrent. > ThreadPoolExecutor/runWorker > ThreadPoolExecutor.java: 617 java.util.concurrent. > ThreadPoolExecutor$Worker/run > Thread.java: 745 java.lang.Thread/run > > 1. Caused by java.lang.Exception > Found lib name 'incanter.stats' containing period with prefix 'quote'. > lib > names inside prefix lists must not contain periods > > core.clj: 659 clojure.core/apply > core.clj: 5893 clojure.core/load-libs > core.clj: 5873 clojure.core/load-libs > RestFn.java: 137 clojure.lang.RestFn/applyTo > core.clj: 659 clojure.core/apply > core.clj: 5911 clojure.core/require > core.clj: 5911 clojure.core/require > RestFn.java: 408 clojure.lang.RestFn/invoke > REPL: 1 user/eval46259/loading--auto-- > REPL: 1 user/eval46259 > REPL: 1 user/eval46259 > Compiler.java: 6977 clojure.lang.Compiler/eval > Compiler.java: 6966 clojure.lang.Compiler/eval > Compiler.java: 6940 clojure.lang.Compiler/eval > core.clj: 3187 clojure.core/eval > core.clj: 3183 clojure.core/eval > main.clj: 242 clojure.main/repl/read-eval-print/fn > main.clj: 242 clojure.main/repl/read-eval-print > main.clj: 260 clojure.main/repl/fn > main.clj: 260 clojure.main/repl > main.clj: 176 clojure.main/repl > RestFn.java: 1523 clojure.lang.RestFn/invoke > interruptible_eval.clj: 87 clojure.tools.nrepl. > middleware.interruptible-eval/evaluate/fn > AFn.java: 152 clojure.lang.AFn/applyToHelper > AFn.java: 144 clojure.lang.AFn/applyTo > core.clj: 657 clojure.core/apply > core.clj: 1963 clojure.core/with-bindings* > core.clj: 1963 clojure.core/with-bindings* > RestFn.java: 425 clojure.lang.RestFn/invoke > interruptible_eval.clj: 85 clojure.tools.nrepl. > middleware.interruptible-eval/evaluate > interruptible_eval.clj: 55 clojure.tools.nrepl. > middleware.interruptible-eval/evaluate > interruptible_eval.clj: 222 clojure.tools.nrepl. > middleware.interruptible-eval/interruptible-eval/fn/fn > interruptible_eval.clj: 190 clojure.tools.nrepl. > middleware.interruptible-eval/run-next/fn > AFn.java: 22 clojure.lang.AFn/run > ThreadPoolExecutor.java: 1142 java.util.concurrent. > ThreadPoolExecutor/runWorker > ThreadPoolExecutor.java: 617 java.util.concurrent. > ThreadPoolExecutor$Worker/run > Thread.java: 745 java.lang.Thread/run > ``` > > > [stardiviner] GPG key ID: 47C32433 > IRC(freeenode): stardiviner Twitter: @numbchild > Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 > Blog: http://stardiviner.github.io/ > > On Sat, Jun 17, 2017 at 9:46 AM, Tim Cross wrote: > >> >> My guess is that cider is not finding the incanter package in the >> classpath when the first block attempts to evaluate. Another issue is >> that your not using any session options, so your two blocks will be >> evaluated in separate environments - not a real problem with your >> current example, but will be an issue if you expect to access incanter >> functions from separate babel blocks. >> >> There are a number of working parts which all need to be lined up >> correctly before babel clojure support will work correctly. Getting >> things to work when your just using core clojure functions is fairly >> trivial, but getting it to work when you have to pull in other >> dependencies can be a little tricky. >> >> You might find this article useful to get started >> >> http://fgiasson.com/blog/index.php/2016/06/21/optimal-emacs- >> settings-for-org-mode-for-literate-programming/ >> >> I also notice you have not set the org-babel-clojure-backend, which you >> need to do. My recommendation would be to do the following >> >> 1. Create a leinegen project to experiment with i.e. >> lein new app my-kk >> >> 2. Make sure you can edit and evaluate clojure just using clojure-mode >> and cider in emacs >> >> 3. Add the incanter package to your project.clj dependencies key >> >> 4. Modify core.clj (using clojure-mode) to include the code in your >> clojure blocks and run with cider to make sure they work as expected. >> >> 5. Create the org file you want to experiment with in the root of your >> project. This should ensure that when you try to evaluate clojure >> blocks, the cider backend will be loaded with the dependencies in the >> project.clj file. >> >> 6. Copy the code in your core.clj file into ONE babel src block and see >> if you can get it to evaluate correctly. Experiment with the block >> configuration options like :output etc. >> >> 7. Break the code up into different blocks and experiment with block >> options, especially session options. >> >> Once you get to that point, you should be across the various moving >> parts with sufficient understanding to then look at how you can tweak >> things to get exactly the behaviour and workflow you want. >> >> HTH >> >> Tim >> >> numbchild@gmail.com writes: >> >> > When Org-mode buffer like this: >> > >> > #+BEGIN_SRC clojure >> > (ns my.kk >> > (:require '[incanter.core :as kk])) >> > #+END_SRC >> > >> > #+BEGIN_SRC clojure >> > (print "hi") >> > (def kkkk "hello") >> > #+END_SRC >> > >> > #+RESULTS: >> > >> > When I have `(ns ..)` namespace clojure code in buffer, the second >> `(print >> > ..)` clojure result nothing. But when I remove the first src block, the >> > `(print ..)` clojure src block works fine. >> > >> > I'm using Org-mode version from `master` with `use-package` like this: >> > >> > (use-package org >> > :load-path "~/Code/Emacs/org-mode/lisp/" >> > :pin manual >> > :mode (("\\.org$" . org-mode)) >> > :config >> > (use-package org-plus-contrib >> > :load-path "~/Code/Emacs/org-mode/contrib/lisp/" >> > :pin manual) >> > ) >> > >> > >> > [stardiviner] GPG key ID: 47C32433 >> > IRC(freeenode): stardiviner Twitter: @numbchild >> > Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 >> > Blog: http://stardiviner.github.io/ >> >> >> -- >> Tim Cross >> > > --f403045f581a5e1b29055227dc66 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
After a new evaluation. I found
```org
#+BEGIN_SRC clojure
(ns user
=C2=A0 (:require '[incanter.core :as mm]))
#+END_SRC=
=
#+RESULTS:
: class clojure.lang.Compiler$CompilerExcepti= onclass clojure.lang.Compiler$CompilerExceptionCompilerException java.lang.= Exception: Found lib name 'incanter.core' containing period with pr= efix 'quote'. =C2=A0lib names inside prefix lists must not contain = periods, compiling:(/home/stardiviner/Code/learning/Emacs/Org-mode/ob-cloju= re.org:1:1)=C2=A0

#+BEGIN_SRC clojure :session :results ou= tput
(print "hi")
= (def kkkk "hello")=
= #+END_SRC

#+RESULTS:
: hi
```

Both two src blocks works. Beca= use the first src block Clojure namespace `(ns user ..)` is same with CIDER= REPL default namespace `user`. So it works.

But when I tried add header argument `:= eval no` on first src block like this:

```org
#+BEGIN_SRC clojure :session :eval no
(ns user.kk
=C2=A0 (:require '[incanter.core :as mm]= ))
#+END_SRC

<= font face=3D"trebuchet ms, sans-serif">#+RESULTS:

#+BEGIN_SRC clojure :session :results output
(print "hi")=
(def kkkk "hello&qu= ot;)
#+END_SRC

#+RESULTS:
```

The second src block = failed again. So I think `ob-clojure` will try to evaluate the first src bl= ock even I added header argument `:eval no`. So `ob-clojure.el` does not re= spect header argument `:eval no`. But I think might because `:eval no` is n= ot work for this purpose. I did can't evaluate by pressing `[C-c C-c]` = on first block.

<= div dir=3D"ltr">
[stardiviner]=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Hack this world!>=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 GPG key ID: 47C32433
IRC(freeenode): stardiviner =C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Twitter:=C2=A0 @numbchild
Key finge= rprint =3D 9BAA 92BC CDDD B9EF 3B36=C2=A0 CB99 B8C4 B8E5 47C3 2433
Blog:= http://stardiv= iner.github.io/

On Sat, Jun 17, 2017 at 8:57 PM, numbchild@gmail.com <<= a href=3D"mailto:numbchild@gmail.com" target=3D"_blank">numbchild@gmail.com= > wrote:
<= div class=3D"gmail_default" style=3D"font-family:"trebuchet ms",s= ans-serif">I did configure `ob-clojure` with the following settings:
<= div class=3D"gmail_default" style=3D"font-family:"trebuchet ms",s= ans-serif">
```elisp
(requ= ire 'ob-clojure)

;; use CIDER as the Clojure execution= backend
(setq org-babel-clojure-backend 'cider)

;; Useful keybindings when using Clojure from Org
;; (org-defkey o= rg-mode-map (kbd "C-x C-e") 'cider-eval-last-sexp)
;; (= org-defkey org-mode-map (kbd "C-c C-d") 'cider-doc)
;; No timeout when executing calls on Cider via nrepl
<= div class=3D"gmail_default">;; (set= q org-babel-clojure-sync-nrepl-timeout nil)

;; let `o= b-clojure' babel src blocks allow evaluation.
(add-to-list 'o= rg-babel-default-header-args:clojure
=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0'(:eval . "yes"))
(add-to-list = 9;org-babel-default-header-args:clojure
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0'(:results . "output"))
<= div class=3D"gmail_default">;; (add= -to-list 'org-babel-default-header-args:clojure
;; =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'(:show-process . t))
```

<= div style=3D"font-family:"trebuchet ms",sans-serif">I start CIDER= REPL session with `cider-jack-in` without project in Emacs.

I changed namespace to= `user` in src blocks like this:

```org
#+BEGIN_SRC clojure
(ns user
=C2=A0 (:require '[incanter.core :as kk]))<= /div>
#+END_SRC

#+RESULTS:

#+BEGIN_SRC clojure :session :results output
<= span class=3D"">
(print "h= i")
(def kkkk= "hello")

#+RESULTS:
: hi
```

<= div style=3D"font-family:"trebuchet ms",sans-serif">Then it works= .

<= /div>
Seems y= ou're right, might my first src block can't work correctly. That ca= used second src block evaluation failed.

But I require `incanter` works, I have `inc= anter` in Leiningen dependencies.
```clojure
(require '[incanter.core :as kk])
```

But include `incanter`= in namespace failed:
```clojure
(ns user
=C2=A0 (:require '[incanter.= core :as kk]))
```
with the following error.
```
=C2=A0 Show: Clojure Java REPL Tooling Duplicates All =C2=A0= (29 frames hidden)

2. Unhandled= clojure.lang.Compiler$CompilerException
=C2=A0 =C2=A0Error compiling Code/learning/Em= acs/Org-mode/ob-cl= ojure.org at (1:1)

=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 core.clj: 5771 =C2= =A0clojure.core/throw-if
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 core.= clj: 5835 =C2=A0clojure.core/load-lib
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 core.clj: 5832 =C2=A0clojure.core/load-lib
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0RestFn.java: =C2=A0142 =C2=A0clojure.lang.RestFn/applyTo
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 core.clj: =C2=A0659 =C2=A0clojure= .core/apply
=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 core.clj: 5893 =C2= =A0clojure.core/load-libs
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 core= .clj: 5873 =C2=A0clojure.core/load-libs
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0RestFn.java: =C2=A0137 =C2=A0clojure.lang.RestFn/applyTo
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 core.clj: =C2=A0659 =C2=A0clojure.core/appl= y
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 core.clj: 5911 =C2=A0cloju= re.core/require
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 core.clj: 59= 11 =C2=A0clojure.core/require
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RestFn.j= ava: =C2=A0408 =C2=A0clojure.lang.RestFn/invoke
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 REPL: =C2=A0 =C2=A01 =C2=A0user/eval46259/l= oading--auto--
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 REPL: =C2=A0 =C2=A01 =C2=A0user/eval46259
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Compiler.java: 6977 =C2=A0clojure.lang.Compi= ler/eval
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Compiler.java: 6966 =C2=A0clojure.= lang.Compiler/eval
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Compiler.java: 6940 =C2=A0= clojure.lang.Compiler/eval
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cor= e.clj: 3187 =C2=A0clojure.core/eval
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 core.clj: 3183 =C2=A0clojure.core/eval
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 main.clj: =C2=A0242 =C2=A0clojure.main/repl/read-eval-print/fn
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 main.clj: =C2=A0242= =C2=A0clojure.main/repl/read-eval-print
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 main.clj: =C2=A0260 =C2=A0clojure.main/repl/fn
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 main.clj: =C2=A0260 =C2=A0clojure.main/r= epl
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 main.clj: =C2=A0176 =C2=A0= clojure.main/repl
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RestFn.java: 1523 = =C2=A0clojure.lang.RestFn/invoke
=C2=A0 =C2=A0 interruptible_eval.clj: =C2=A0 87 =C2=A0clojur= e.tools.nrepl.middleware.interruptible-eval/evaluate/fn
=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 AFn.java: =C2=A0152 =C2=A0clojure.lang.= AFn/applyToHelper
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 AFn.jav= a: =C2=A0144 =C2=A0clojure.lang.AFn/applyTo
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 core.clj: =C2=A0657 =C2=A0clojure.core/apply
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 core.clj: 1963 =C2=A0clojure.core/with-binding= s*
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 core.clj: 1963 =C2=A0cloju= re.core/with-bindings*
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RestFn.java: = =C2=A0425 =C2=A0clojure.lang.RestFn/invoke
=C2=A0 =C2=A0 interruptible_eval.clj: =C2=A0 85 = =C2=A0clojure.tools.nrepl.middleware.interruptible-eval/evaluate<= /font>
=C2=A0 =C2=A0 inte= rruptible_eval.clj: =C2=A0 55 =C2=A0clojure.tools.nrepl.middleware.int= erruptible-eval/evaluate
=C2=A0 =C2=A0 interruptible_eval.clj: =C2=A0222 =C2=A0clojure.t= ools.nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn=
=C2=A0 =C2=A0 int= erruptible_eval.clj: =C2=A0190 =C2=A0clojure.tools.nrepl.middleware.in= terruptible-eval/run-next/fn
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 AFn.java: =C2=A0 22 =C2=A0clojure.lang.AFn/run
=C2=A0 =C2=A0ThreadPoolExecutor.java: 1142= =C2=A0java.util.concurrent.ThreadPoolExecutor/runWorker
<= div>=C2=A0 =C2=A0ThreadPoolExecutor= .java: =C2=A0617 =C2=A0java.util.concurrent.ThreadPoolExecutor$Worker/= run
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Thread.java: =C2=A0745 =C2=A0java.= lang.Thread/run
1. Caused by ja= va.lang.Exception
= =C2=A0 =C2=A0Found lib name 'incanter.stats' containing period with= prefix 'quote'. lib
=C2=A0 =C2=A0names inside prefix lists must not contain periods<= /font>

<= div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 core.clj: =C2=A0659 =C2=A0clojure.core/appl= y
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 core.clj: 5893 =C2=A0cloju= re.core/load-libs
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 core.clj: 58= 73 =C2=A0clojure.core/load-libs
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RestFn= .java: =C2=A0137 =C2=A0clojure.lang.RestFn/applyTo
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 core.clj: =C2=A0659 =C2=A0clojure.core/apply
=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 core.clj: 5911 =C2=A0clojure.core/requi= re
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 core.clj: 5911 =C2=A0cloju= re.core/require
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RestFn.java: =C2=A04= 08 =C2=A0clojure.lang.RestFn/invoke
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 REPL: =C2=A0 =C2=A01 =C2=A0user/eval46259/loading--aut= o--
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 REPL:= =C2=A0 =C2=A01 =C2=A0user/eval46259
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 REPL: =C2=A0 =C2=A01 =C2=A0user/eval46259
=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0Compiler.java: 6977 =C2=A0clojure.lang.Compiler/eval
=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0Compiler.java: 6966 =C2=A0clojure.lang.Compiler= /eval
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Compiler.java: 6940 =C2=A0clojure.lan= g.Compiler/eval
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 core.clj: 31= 87 =C2=A0clojure.core/eval
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cor= e.clj: 3183 =C2=A0clojure.core/eval
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 main.clj: =C2=A0242 =C2=A0clojure.main/repl/read-eval-print/fn<= /font>
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 main.clj: =C2=A0242 =C2=A0clo= jure.main/repl/read-eval-print
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 main.clj: =C2=A0260 =C2=A0clojure.main/repl/fn
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 main.clj: =C2=A0260 =C2=A0clojure.main/repl=
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 main.clj: =C2=A0176 =C2=A0clojure.ma= in/repl
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RestFn.java: 1523 =C2=A0clojur= e.lang.RestFn/invoke
=C2=A0 =C2=A0 interruptible_eval.clj: =C2=A0 87 =C2=A0clojure.tools.nrep= l.middleware.interruptible-eval/evaluate/fn
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 AFn.java: =C2=A0152 =C2=A0clojure.lang.AFn/ap= plyToHelper
=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 AFn.java: =C2=A014= 4 =C2=A0clojure.lang.AFn/applyTo
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 core.clj: =C2=A0657 =C2=A0clojure.core/apply
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 core.clj: 1963 =C2=A0clojure.core/with-bindings*
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 core.clj: 1963 =C2=A0clojure.core= /with-bindings*
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RestFn.java: =C2=A04= 25 =C2=A0clojure.lang.RestFn/invoke
=C2=A0 =C2=A0 interruptible_eval.clj: =C2=A0 85 =C2=A0clo= jure.tools.nrepl.middleware.interruptible-eval/evaluate
=C2=A0 =C2=A0 interruptible= _eval.clj: =C2=A0 55 =C2=A0clojure.tools.nrepl.middleware.interruptibl= e-eval/evaluate
=C2=A0 =C2=A0 interruptible_eval.clj: =C2=A0222 =C2=A0clojure.tools.nrep= l.middleware.interruptible-eval/interruptible-eval/fn/fn
=C2=A0 =C2=A0 interruptibl= e_eval.clj: =C2=A0190 =C2=A0clojure.tools.nrepl.middleware.interruptib= le-eval/run-next/fn
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 AFn.j= ava: =C2=A0 22 =C2=A0clojure.lang.AFn/run
=C2=A0 =C2=A0ThreadPoolExecutor.java: 1142 =C2=A0ja= va.util.concurrent.ThreadPoolExecutor/runWorker
=C2=A0 =C2=A0ThreadPoolExecutor.java: = =C2=A0617 =C2=A0java.util.concurrent.ThreadPoolExecutor$Worker/run
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Thread.java: =C2=A0745 =C2=A0java.lang.Th= read/run
```


[stardiviner]=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 <Hack this world!>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 GPG key ID= : 47C32433
IRC(freeenode): stardiviner =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 Twitter:=C2=A0 @numbchild
Key fingerprint =3D 9BAA 92BC CDDD B9EF= 3B36=C2=A0 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/
<= /div>

On Sat, Jun 17= , 2017 at 9:46 AM, Tim Cross <theophilusx@gmail.com> wro= te:

My guess is that cider is not finding the incanter package in the
classpath when the first block attempts to evaluate. Another issue is
that your not using any session options, so your two blocks will be
evaluated in separate environments - not a real problem with your
current example, but will be an issue if you expect to access incanter
functions from separate babel blocks.

There are a number of working parts which all need to be lined up
correctly before babel clojure support will work correctly. Getting
things to work when your just using core clojure functions is fairly
trivial, but getting it to work when you have to pull in other
dependencies can be a little tricky.

You might find this article useful to get started

http://fgiasson.com/blog/index.php/2016/06/21/optimal-emacs-settings-for-org-mode-for-literate-programming/

I also notice you have not set the org-babel-clojure-backend, which you
need to do. My recommendation would be to do the following

1. Create a leinegen project to experiment with i.e.
lein new app my-kk

2. Make sure you can edit and evaluate clojure just using clojure-mode
and cider in emacs

3. Add the incanter package to your project.clj dependencies key

4. Modify core.clj (using clojure-mode) to include the code in your
clojure blocks and run with cider to make sure they work as expected.

5. Create the org file you want to experiment with in the root of your
project. This should ensure that when you try to evaluate clojure
blocks, the cider backend will be loaded with the dependencies in the
project.clj file.

6. Copy the code in your core.clj file into ONE babel src block and see
if you can get it to evaluate correctly. Experiment with the block
configuration options like :output etc.

7. Break the code up into different blocks and experiment with block
options, especially session options.

Once you get to that point, you should be across the various moving
parts with sufficient understanding to then look at how you can tweak
things to get exactly the behaviour and workflow you want.

HTH

Tim

numbchild@gmail.co= m writes:

> When Org-mode buffer like this:
>
> #+BEGIN_SRC clojure
> (ns my.kk
>=C2=A0 =C2=A0(:require '[incanter.core :as kk]))
> #+END_SRC
>
> #+BEGIN_SRC clojure
> (print "hi")
> (def kkkk "hello")
> #+END_SRC
>
> #+RESULTS:
>
> When I have `(ns ..)` namespace clojure code in buffer, the second `(p= rint
> ..)` clojure result nothing. But when I remove the first src block, th= e
> `(print ..)` clojure src block works fine.
>
> I'm using Org-mode version from `master` with `use-package` like t= his:
>
> (use-package org
>=C2=A0 =C2=A0:load-path "~/Code/Emacs/org-mode/lisp/"
>=C2=A0 =C2=A0:pin manual
>=C2=A0 =C2=A0:mode (("\\.org$" . org-mode))
>=C2=A0 =C2=A0:config
>=C2=A0 =C2=A0(use-package org-plus-contrib
>=C2=A0 =C2=A0 =C2=A0:load-path "~/Code/Emacs/org-mode/contrib= /lisp/"
>=C2=A0 =C2=A0 =C2=A0:pin manual)
>=C2=A0 =C2=A0)
>
>
> [stardiviner]=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<Hack this wo= rld!>=C2=A0 =C2=A0 =C2=A0 GPG key ID: 47C32433
> IRC(freeenode): stardiviner=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Twitter:=C2=A0 @numbchild
> Key fingerprint =3D 9BAA 92BC CDDD B9EF 3B36=C2=A0 CB99 B8C4 B8E5 47C3= 2433
> Blog: http://stardiviner.github.io/


--
Tim Cross


--f403045f581a5e1b29055227dc66--