From mboxrd@z Thu Jan 1 00:00:00 1970 From: "numbchild@gmail.com" Subject: Re: ob-clojure broken Date: Sat, 4 Mar 2017 20:04:15 +0800 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1143d5cae458d30549e67779 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ck8Qc-0002b8-BC for emacs-orgmode@gnu.org; Sat, 04 Mar 2017 07:04:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ck8Qa-0002d0-TI for emacs-orgmode@gnu.org; Sat, 04 Mar 2017 07:04:50 -0500 Received: from mail-it0-x22a.google.com ([2607:f8b0:4001:c0b::22a]:37249) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ck8Qa-0002bS-N0 for emacs-orgmode@gnu.org; Sat, 04 Mar 2017 07:04:48 -0500 Received: by mail-it0-x22a.google.com with SMTP id 203so27612965ith.0 for ; Sat, 04 Mar 2017 04:04:47 -0800 (PST) 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 --001a1143d5cae458d30549e67779 Content-Type: text/plain; charset=UTF-8 I already applied the patch at here: https://emacs.stackexchange.com/questions/30857/clojure-code-evaluation-in-org-mode-produces-no-output [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 Thu, Mar 2, 2017 at 7:01 AM, Tim Cross wrote: > With current 9.0.5 org-plus-contrib package, ob-clojure is broken and > trying to evaluate clojure source blocks just gives a code block produces > no output message. > > The problem is in the org-babel-execute:clojure function. This function > has the following bit of code > > (setq result > (nrepl-dict-get > (nrepl-sync-request:eval > expanded (cider-current-connection) (cider-current-session)) > (if (or (member "output" result-params) > (member "pp" result-params)) > "out" > "value"))) > > The problem is in the call to nrepl-sync-request:eval. The documentation > states for this function > > (nrepl-sync-request:eval INPUT CONNECTION &optional NS) > > Send the INPUT to the nREPL server synchronously. The request is > dispatched via CONNECTION. If NS is non-nil, include it in the request. > Note the last optional argument NS. This is supposed to be a clojure > namespace. However, the org-babel-execute:clojure function is calling this > function with the output from cider-current-session, which returns a unique > ID representing the current session. As a result, the call is returning a > data structure with an error and no output (perhaps some error handling is > required). The returned result is > > (dict status (namespace-not-found done error done state state) id 17 > session 43e9fd6c-82ed-49fe-9624-0cfc6f56f8b1 changed-namespaces (dict) > repl-type cljclj) > > Note the namespace-not-found > > Either the argument should be a call to (cider-current-ns) or perhaps it > should just be left out as I don't see how you can pass the namespace as > part of the block evaluation. > > > -- > regards, > > Tim > > -- > Tim Cross > > --001a1143d5cae458d30549e67779 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

[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.g= ithub.io/

On Thu, Mar 2, 2017 at 7:01 AM, Tim Cross <theophilusx@gmail.com> wrote:
With current 9.0.5 org-plus-contrib package, ob-clo= jure is broken and trying to evaluate clojure source blocks just gives a co= de block produces no output message.

The problem is= in the org-babel-execute:clojure function. This function has the following= bit of code

(setq result
=C2=A0 =C2=A0 = =C2=A0 =C2=A0(nrepl-dict-get
=C2=A0 =C2=A0 (nrepl-sync-request:ev= al
=C2=A0 =C2=A0 =C2=A0expanded (cider-current-connection) (cider= -current-session))
=C2=A0 =C2=A0 (if (or (member "output&quo= t; result-params)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (member "pp&qu= ot; result-params))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 "out"
=C2=A0 =C2=A0 =C2=A0 "value")))

The problem is in the call to nrepl-sync-request:eval. The documentation s= tates for this function

(nrepl-sync-request:eval I= NPUT CONNECTION &optional NS)

Send the INPUT t= o the nREPL server synchronously. The request is dispatched via CONNECTION.= If NS is non-nil, include it in the request.
Note the last optio= nal argument NS. This is supposed to be a clojure namespace. However, the o= rg-babel-execute:clojure function is calling this function with the output = from cider-current-session, which returns a unique ID representing the curr= ent session. As a result, the call is returning a data structure with an er= ror and no output (perhaps some error handling is required). The returned r= esult is

(dict status (namespace-not-found done er= ror done state state) id 17 session 43e9fd6c-82ed-49fe-9624-0cfc6f56f8= b1 changed-namespaces (dict) repl-type cljclj)

Not= e the namespace-not-found

Either the argument shou= ld be a call to (cider-current-ns) or perhaps it should just be left out as= I don't see how you can pass the namespace as part of the block evalua= tion.


--
regards,

Tim

--
Tim Cross


--001a1143d5cae458d30549e67779--