emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* ob-clojure broken
@ 2017-03-01 23:01 Tim Cross
  2017-03-04 12:04 ` numbchild
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Cross @ 2017-03-01 23:01 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1607 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2147 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ob-clojure broken
  2017-03-01 23:01 ob-clojure broken Tim Cross
@ 2017-03-04 12:04 ` numbchild
  2017-03-04 12:37   ` Tim Cross
  0 siblings, 1 reply; 3+ messages in thread
From: numbchild @ 2017-03-04 12:04 UTC (permalink / raw)
  To: Tim Cross; +Cc: Org-mode

[-- Attachment #1: Type: text/plain, Size: 2154 bytes --]

I already applied the patch at here:
https://emacs.stackexchange.com/questions/30857/clojure-code-evaluation-in-org-mode-produces-no-output


[stardiviner]           <Hack this world!>      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 <theophilusx@gmail.com> 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
>
>

[-- Attachment #2: Type: text/html, Size: 3548 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ob-clojure broken
  2017-03-04 12:04 ` numbchild
@ 2017-03-04 12:37   ` Tim Cross
  0 siblings, 0 replies; 3+ messages in thread
From: Tim Cross @ 2017-03-04 12:37 UTC (permalink / raw)
  To: numbchild@gmail.com; +Cc: Org-mode

[-- Attachment #1: Type: text/plain, Size: 2418 bytes --]

thanks. There is a later message to the list where I attached the patch.

tim


On 4 March 2017 at 23:04, numbchild@gmail.com <numbchild@gmail.com> wrote:

> I already applied the patch at here: https://emacs.
> stackexchange.com/questions/30857/clojure-code-evaluation-
> in-org-mode-produces-no-output
>
>
> [stardiviner]           <Hack this world!>      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 <theophilusx@gmail.com> 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
>>
>>
>


-- 
regards,

Tim

--
Tim Cross

[-- Attachment #2: Type: text/html, Size: 4440 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-04 12:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-01 23:01 ob-clojure broken Tim Cross
2017-03-04 12:04 ` numbchild
2017-03-04 12:37   ` Tim Cross

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).