* [PATCH] New header parameter :show-process for Org-babel-clojure
@ 2016-11-07 19:19 Frederick Giasson
2016-11-10 15:18 ` Nicolas Goaziou
0 siblings, 1 reply; 16+ messages in thread
From: Frederick Giasson @ 2016-11-07 19:19 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1172 bytes --]
Hi Nicolas,
The new Org-mode release 9.0 made me realize that I never finished some
of my work with Org-babel-clojure.
I noticed that you included some of my previous fixes in
Org-babel-clojure, so here are the latest work I did. I updated it to
work with the latest code on Git. I did two things with these fixes:
(1) I better handle any possible error or exceptions that may be
raised by nREPL by displaying any errors in the RESULTS section
(2) I added a new header option called ":show-process" which create a
new window/buffer to display anything that is outputted by the Clojure
code in the code block.
In the past, I did refer to this as ":async", but as we discussed at
that time, it really was not async. So I changed the naming of this new
feature to remove this ambiguity.
One thing I noticed in this process is that you actually did update worg
with the documentation of ":async" but didn't add the actual
Org-babel-clojure code modifications.
In any case, I did update the worg documentation accordingly too.
Finally I updated ORG-NEWS in the 9.1 section.
See the patch files attached to this email.
Thanks!
Take care,
Fred
[-- Attachment #2: 0001-Better-error-handling-with-nREPL.-Displaying-any-pos.patch --]
[-- Type: text/plain, Size: 6232 bytes --]
From df8284b45c35e0c1dcbccf40ba7b76fd18270b90 Mon Sep 17 00:00:00 2001
From: Frederick Giasson <fred@fgiasson.com>
Date: Mon, 7 Nov 2016 13:48:50 -0500
Subject: [PATCH 1/2] Better error handling with nREPL. Displaying any possible
errors or exceptions in the result block. Adding a new :show-process header
option such that the underlying process of a Clojure block code get output in
a new buffer and a new window such that the developer can see what is going
on.
---
lisp/ob-clojure.el | 106 +++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 82 insertions(+), 24 deletions(-)
diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
index 72ea77d..4800c9a 100644
--- a/lisp/ob-clojure.el
+++ b/lisp/ob-clojure.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2009-2016 Free Software Foundation, Inc.
-;; Author: Joel Boehland, Eric Schulte, Oleh Krehel
+;; Author: Joel Boehland, Eric Schulte, Oleh Krehel, Frederick Giasson
;;
;; Keywords: literate programming, reproducible research
;; Homepage: http://orgmode.org
@@ -84,34 +84,92 @@
body)))
(defun org-babel-execute:clojure (body params)
- "Execute a block of Clojure code with Babel."
+ "Execute a block of Clojure code with Babel. The underlying process performed by the
+ code block can be output using the :show-process parameter"
(let ((expanded (org-babel-expand-body:clojure body params))
- result)
+ (sbuffer "*Clojure Show Process Sub Buffer*")
+ (show (if (assoc :show-process params) t nil))
+ (response (cons 'dict nil))
+ status
+ result)
(cl-case org-babel-clojure-backend
(cider
(require 'cider)
(let ((result-params (cdr (assq :result-params params))))
- (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")))))
- (slime
- (require 'slime)
- (with-temp-buffer
- (insert expanded)
- (setq result
- (slime-eval
- `(swank:eval-and-grab-output
- ,(buffer-substring-no-properties (point-min) (point-max)))
- (cdr (assq :package params)))))))
- (org-babel-result-cond (cdr (assq :result-params params))
- result
- (condition-case nil (org-babel-script-escape result)
- (error result)))))
+ ; Check if the user want show the process in an output buffer/window
+ (when show
+ ; Create a new window with the show output buffer
+ (switch-to-buffer-other-window sbuffer)
+
+ ; Run the Clojure code in nREPL
+ (nrepl-request:eval
+ expanded
+ (lambda (resp)
+ (when (member "out" resp)
+ ; Print the output of the nREPL in the output buffer
+ (princ (nrepl-dict-get resp "out") (get-buffer sbuffer)))
+ (when (member "ex" resp)
+ ; In case there is an exception, then add it to the output buffer as well
+ (princ (nrepl-dict-get resp "ex") (get-buffer sbuffer))
+ (princ (nrepl-dict-get resp "root-ex") (get-buffer sbuffer)))
+ (when (member "err" resp)
+ ; In case there is an error, then add it to the output buffer as well
+ (princ (nrepl-dict-get resp "err") (get-buffer sbuffer)))
+ (nrepl--merge response resp)
+ ; Update the status of the nREPL output session
+ (setq status (nrepl-dict-get response "status")))
+ (cider-current-connection)
+ (cider-current-session))
+
+ ; Wait until the nREPL code finished to be processed
+ (while (not (member "done" status))
+ (nrepl-dict-put response "status" (remove "need-input" status))
+ (accept-process-output nil 0.01)
+ (redisplay))
+
+ ; Delete the show buffer & window when the processing is finalized
+ (let ((wins (get-buffer-window-list sbuffer nil t)))
+ (dolist (win wins)
+ (delete-window win))
+ (kill-buffer sbuffer))
+
+ ; Put the output or the value in the result section of the code block
+ (setq result (concat (nrepl-dict-get response
+ (if (or (member "output" result-params)
+ (member "pp" result-params))
+ "out"
+ "value"))
+ (nrepl-dict-get response "ex")
+ (nrepl-dict-get response "root-ex")
+ (nrepl-dict-get response "err"))))
+ ; Check if user want to run code without showing the process
+ (when (not show)
+ (setq response (let ((nrepl-sync-request-timeout
+ org-babel-clojure-sync-nrepl-timeout))
+ (nrepl-sync-request:eval
+ expanded (cider-current-connection) (cider-current-session))))
+ (setq result
+ (concat
+ (nrepl-dict-get response (if (or (member "output" result-params)
+ (member "pp" result-params))
+ "out"
+ "value"))
+ (nrepl-dict-get response "ex")
+ (nrepl-dict-get response "root-ex")
+ (nrepl-dict-get response "err"))))))
+ (slime
+ (require 'slime)
+ (with-temp-buffer
+ (insert expanded)
+ (setq result
+ (slime-eval
+ `(swank:eval-and-grab-output
+ ,(buffer-substring-no-properties (point-min) (point-max)))
+ (cdr (assq :package params)))))))
+ (org-babel-result-cond (cdr (assq :result-params params))
+ result
+ (condition-case nil (org-babel-script-escape result)
+ (error result)))))
(provide 'ob-clojure)
--
1.9.5.msysgit.0
[-- Attachment #3: 0001-Adding-documentation-for-the-new-show-process-header.patch --]
[-- Type: text/plain, Size: 2324 bytes --]
From 89c8ff0e8784d1ccafc1a6fa5ede8d22bbb667b8 Mon Sep 17 00:00:00 2001
From: Frederick Giasson <fred@fgiasson.com>
Date: Mon, 7 Nov 2016 14:09:30 -0500
Subject: [PATCH] Adding documentation for the new :show-process header option
for Org-babel-clojure
---
org-contrib/babel/languages/ob-doc-clojure.org | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/org-contrib/babel/languages/ob-doc-clojure.org b/org-contrib/babel/languages/ob-doc-clojure.org
index 9f1b8b1..670e7aa 100644
--- a/org-contrib/babel/languages/ob-doc-clojure.org
+++ b/org-contrib/babel/languages/ob-doc-clojure.org
@@ -145,26 +145,29 @@ Another source for information on options is this page at Worg:
Next, a similar process for executing code will be used with Clojure.
-* Using Asynchronous Evaluations
-Org-babel-clojure does support asynchronous evaluation of the code blocks. To
-evaluate some code asynchronously, you only have to specify the =:async= option
+* Show Process Of Code Block Execution
+You can tell Org-babel-clojure to output the process of a running code block.
+
+To show that output you only have to specify the =:show-process= option
in the code block's header like this:
#+begin_example
-#+BEGIN_SRC clojure :results output :async
+#+BEGIN_SRC clojure :results output :show-process
(dotimes [n 10]
(println n ".")
(Thread/sleep 500))
#+END_SRC
#+end_example
-If =:async= is specified that way, then when you will run the code using
-=C-c C-c= then a new window will open in Emacs. Everything that is output
+If =:show-process= is specified that way, then when you will run the code using
+=C-c C-c= a new window will open in Emacs. Everything that is output
by the REPL will immediately be added to that new window.
When the processing of the code is finished, then the window and its
buffer will be closed and the results will be reported in the
-=#+RESULTS= section. Note that the =:results= parameter like normally. If
+=#+RESULTS= section.
+
+Note that the =:results= parameter's behavior is *not* changed. If
=silent= is specified, then no result will be displayed. If =output= is
specified then all the output from the window will appears in the results
section. If =value= is specified, then only the last returned value of
--
1.9.5.msysgit.0
[-- Attachment #4: 0002-Update-ORG-NEWS-to-mention-the-new-show-process-feat.patch --]
[-- Type: text/plain, Size: 1874 bytes --]
From c49616a7cccc51c3d3b5f3fda0db2594834b86f6 Mon Sep 17 00:00:00 2001
From: Frederick Giasson <fred@fgiasson.com>
Date: Mon, 7 Nov 2016 14:08:03 -0500
Subject: [PATCH 2/2] Update ORG-NEWS to mention the new :show-process feature
for Org-babel-clojure
---
etc/ORG-NEWS | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index a360e35..95c97a7 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -27,6 +27,38 @@ into
** New features
*** Horizontal rules are no longer ignored in LaTeX table math mode
+*** Org-babel-clojure :show-process
+
+A new block code header has been created for Org-babel-clojure that enables
+developers to output the process of an ongoing process into a new window/buffer.
+
+You can tell Org-babel-clojure to output the process of a running code block.
+
+To show that output you only have to specify the =:show-process= option
+in the code block's header like this:
+
+#+begin_example
+#+BEGIN_SRC clojure :results output :show-process
+ (dotimes [n 10]
+ (println n ".")
+ (Thread/sleep 500))
+#+END_SRC
+#+end_example
+
+If =:show-process= is specified that way, then when you will run the code using
+=C-c C-c= a new window will open in Emacs. Everything that is output
+by the REPL will immediately be added to that new window.
+
+When the processing of the code is finished, then the window and its
+buffer will be closed and the results will be reported in the
+=#+RESULTS= section.
+
+Note that the =:results= parameter's behavior is *not* changed. If
+=silent= is specified, then no result will be displayed. If =output= is
+specified then all the output from the window will appears in the results
+section. If =value= is specified, then only the last returned value of
+the code will be displayed in the results section.
+
* Version 9.0
--
1.9.5.msysgit.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] New header parameter :show-process for Org-babel-clojure
2016-11-07 19:19 [PATCH] New header parameter :show-process for Org-babel-clojure Frederick Giasson
@ 2016-11-10 15:18 ` Nicolas Goaziou
2016-11-10 17:20 ` Frederick Giasson
2016-11-14 20:46 ` Frederick Giasson
0 siblings, 2 replies; 16+ messages in thread
From: Nicolas Goaziou @ 2016-11-10 15:18 UTC (permalink / raw)
To: Frederick Giasson; +Cc: emacs-orgmode
Hello,
Frederick Giasson <fred@fgiasson.com> writes:
> I noticed that you included some of my previous fixes in
> Org-babel-clojure, so here are the latest work I did. I updated it to
> work with the latest code on Git. I did two things with these fixes:
>
>
> (1) I better handle any possible error or exceptions that may be
> raised by nREPL by displaying any errors in the RESULTS section
>
> (2) I added a new header option called ":show-process" which create
> a new window/buffer to display anything that is outputted by the
> Clojure code in the code block.
>
>
> In the past, I did refer to this as ":async", but as we discussed at
> that time, it really was not async. So I changed the naming of this
> new feature to remove this ambiguity.
OK.
> In any case, I did update the worg documentation accordingly too.
>
> Finally I updated ORG-NEWS in the 9.1 section.
I think you can merge patch 2 and 3. ORG-NEWS updates usually do not
require their own
> See the patch files attached to this email.
Thank you. Some nit-picks follow.
> Subject: [PATCH 1/2] Better error handling with nREPL. Displaying any possible
> errors or exceptions in the result block. Adding a new :show-process header
> option such that the underlying process of a Clojure block code get output in
> a new buffer and a new window such that the developer can see what is going
> on.
Could you provide a proper commit message? In particular, each modified
function has to be specified there.
> (defun org-babel-execute:clojure (body params)
> - "Execute a block of Clojure code with Babel."
> + "Execute a block of Clojure code with Babel. The underlying process performed by the
"The underlying..." has to go on the line below.
> + code block can be output using the :show-process parameter"
> (let ((expanded (org-babel-expand-body:clojure body params))
> - result)
> + (sbuffer "*Clojure Show Process Sub Buffer*")
> + (show (if (assoc :show-process params) t nil))
(show (assq :show-process params))
> + (response (cons 'dict nil))
(response (list 'dict))
> + status
> + result)
> + ; Check if the user want show the process in an output buffer/window
Need ";;" instead of ";". Also, full stop missing at the end.
> + (when show
> + ; Create a new window with the show output buffer
;; Create.... output buffer.
> + (switch-to-buffer-other-window sbuffer)
> +
> + ; Run the Clojure code in nREPL
Ditto.
> + (nrepl-request:eval
> + expanded
> + (lambda (resp)
> + (when (member "out" resp)
> + ; Print the output of the nREPL in the output buffer
Ditto.
> + (princ (nrepl-dict-get resp "out") (get-buffer sbuffer)))
> + (when (member "ex" resp)
> + ; In case there is an exception, then add it to the output buffer as well
Ditto.
> + (princ (nrepl-dict-get resp "ex") (get-buffer sbuffer))
> + (princ (nrepl-dict-get resp "root-ex") (get-buffer sbuffer)))
> + (when (member "err" resp)
> + ; In case there is an error, then add it to the output buffer as well
Ditto.
> + (princ (nrepl-dict-get resp "err") (get-buffer sbuffer)))
> + (nrepl--merge response resp)
> + ; Update the status of the nREPL output session
Ditto.
> + (setq status (nrepl-dict-get response "status")))
> + (cider-current-connection)
> + (cider-current-session))
> +
> + ; Wait until the nREPL code finished to be processed
Ditto.
> + (while (not (member "done" status))
> + (nrepl-dict-put response "status" (remove "need-input" status))
> + (accept-process-output nil 0.01)
> + (redisplay))
> +
> + ; Delete the show buffer & window when the processing is finalized
Ditto.
> + (let ((wins (get-buffer-window-list sbuffer nil t)))
> + (dolist (win wins)
> + (delete-window win))
> + (kill-buffer sbuffer))
(mapc #'delete-window (get-buffer-window-list sbuffer nil t))
(kill-buffer sbuffer)
> +
> + ; Put the output or the value in the result section of the code block
See above.
> + (setq result (concat (nrepl-dict-get response
> + (if (or (member "output" result-params)
> + (member "pp" result-params))
> + "out"
> + "value"))
> + (nrepl-dict-get response "ex")
> + (nrepl-dict-get response "root-ex")
> + (nrepl-dict-get response "err"))))
> + ; Check if user want to run code without showing the process
Ditto.
> + (when (not show)
(unless show ...)
BTW, did you sign FSF papers already? I cannot find any reference in
org-contribute.org?
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] New header parameter :show-process for Org-babel-clojure
2016-11-10 15:18 ` Nicolas Goaziou
@ 2016-11-10 17:20 ` Frederick Giasson
2016-11-10 23:55 ` Nicolas Goaziou
2016-11-14 20:46 ` Frederick Giasson
1 sibling, 1 reply; 16+ messages in thread
From: Frederick Giasson @ 2016-11-10 17:20 UTC (permalink / raw)
To: emacs-orgmode
Hi Nicolas,
>> I noticed that you included some of my previous fixes in
>> Org-babel-clojure, so here are the latest work I did. I updated it to
>> work with the latest code on Git. I did two things with these fixes:
>>
>>
>> (1) I better handle any possible error or exceptions that may be
>> raised by nREPL by displaying any errors in the RESULTS section
>>
>> (2) I added a new header option called ":show-process" which create
>> a new window/buffer to display anything that is outputted by the
>> Clojure code in the code block.
>>
>>
>> In the past, I did refer to this as ":async", but as we discussed at
>> that time, it really was not async. So I changed the naming of this
>> new feature to remove this ambiguity.
> OK.
>
>> In any case, I did update the worg documentation accordingly too.
>>
>> Finally I updated ORG-NEWS in the 9.1 section.
> I think you can merge patch 2 and 3. ORG-NEWS updates usually do not
> require their own
>
>> See the patch files attached to this email.
> Thank you. Some nit-picks follow.
>
>> Subject: [PATCH 1/2] Better error handling with nREPL. Displaying any possible
>> errors or exceptions in the result block. Adding a new :show-process header
>> option such that the underlying process of a Clojure block code get output in
>> a new buffer and a new window such that the developer can see what is going
>> on.
> Could you provide a proper commit message? In particular, each modified
> function has to be specified there.
>> (defun org-babel-execute:clojure (body params)
>> - "Execute a block of Clojure code with Babel."
>> + "Execute a block of Clojure code with Babel. The underlying process performed by the
> "The underlying..." has to go on the line below.
>
>> + code block can be output using the :show-process parameter"
>> (let ((expanded (org-babel-expand-body:clojure body params))
>> - result)
>> + (sbuffer "*Clojure Show Process Sub Buffer*")
>> + (show (if (assoc :show-process params) t nil))
> (show (assq :show-process params))
>
>> + (response (cons 'dict nil))
> (response (list 'dict))
>
>> + status
>> + result)
>> + ; Check if the user want show the process in an output buffer/window
> Need ";;" instead of ";". Also, full stop missing at the end.
>
>> + (when show
>> + ; Create a new window with the show output buffer
> ;; Create.... output buffer.
>
>> + (switch-to-buffer-other-window sbuffer)
>> +
>> + ; Run the Clojure code in nREPL
> Ditto.
>
>> + (nrepl-request:eval
>> + expanded
>> + (lambda (resp)
>> + (when (member "out" resp)
>> + ; Print the output of the nREPL in the output buffer
> Ditto.
>
>> + (princ (nrepl-dict-get resp "out") (get-buffer sbuffer)))
>> + (when (member "ex" resp)
>> + ; In case there is an exception, then add it to the output buffer as well
> Ditto.
>
>> + (princ (nrepl-dict-get resp "ex") (get-buffer sbuffer))
>> + (princ (nrepl-dict-get resp "root-ex") (get-buffer sbuffer)))
>> + (when (member "err" resp)
>> + ; In case there is an error, then add it to the output buffer as well
> Ditto.
>
>> + (princ (nrepl-dict-get resp "err") (get-buffer sbuffer)))
>> + (nrepl--merge response resp)
>> + ; Update the status of the nREPL output session
> Ditto.
>> + (setq status (nrepl-dict-get response "status")))
>> + (cider-current-connection)
>> + (cider-current-session))
>> +
>> + ; Wait until the nREPL code finished to be processed
> Ditto.
>
>> + (while (not (member "done" status))
>> + (nrepl-dict-put response "status" (remove "need-input" status))
>> + (accept-process-output nil 0.01)
>> + (redisplay))
>> +
>> + ; Delete the show buffer & window when the processing is finalized
> Ditto.
>
>> + (let ((wins (get-buffer-window-list sbuffer nil t)))
>> + (dolist (win wins)
>> + (delete-window win))
>> + (kill-buffer sbuffer))
> (mapc #'delete-window (get-buffer-window-list sbuffer nil t))
> (kill-buffer sbuffer)
>
>> +
>> + ; Put the output or the value in the result section of the code block
> See above.
>
>> + (setq result (concat (nrepl-dict-get response
>> + (if (or (member "output" result-params)
>> + (member "pp" result-params))
>> + "out"
>> + "value"))
>> + (nrepl-dict-get response "ex")
>> + (nrepl-dict-get response "root-ex")
>> + (nrepl-dict-get response "err"))))
>> + ; Check if user want to run code without showing the process
> Ditto.
>
>> + (when (not show)
> (unless show ...)
Ok good, will fix these issues and resend the patch.
> BTW, did you sign FSF papers already? I cannot find any reference in
> org-contribute.org?
No, what are the FSF papers?
Thanks,
Fred
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] New header parameter :show-process for Org-babel-clojure
2016-11-10 17:20 ` Frederick Giasson
@ 2016-11-10 23:55 ` Nicolas Goaziou
0 siblings, 0 replies; 16+ messages in thread
From: Nicolas Goaziou @ 2016-11-10 23:55 UTC (permalink / raw)
To: Frederick Giasson; +Cc: emacs-orgmode
Hello,
Frederick Giasson <fred@fgiasson.com> writes:
> No, what are the FSF papers?
See <http://orgmode.org/worg/org-contribute.html#org0fa709c>. Since the
patches no longer apply as tiny changes, we need these papers signed to
move forward.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] New header parameter :show-process for Org-babel-clojure
2016-11-10 15:18 ` Nicolas Goaziou
2016-11-10 17:20 ` Frederick Giasson
@ 2016-11-14 20:46 ` Frederick Giasson
2016-11-15 7:49 ` Nicolas Goaziou
1 sibling, 1 reply; 16+ messages in thread
From: Frederick Giasson @ 2016-11-14 20:46 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 306 bytes --]
Hi Nicolas,
> Thank you. Some nit-picks follow.
I made all the changes requested and merged in a single commit. See the
attachment.
> BTW, did you sign FSF papers already? I cannot find any reference in
> org-contribute.org?
I did as of today. Waiting to get a reply from them on that.
Thanks,
Fred
[-- Attachment #2: 0001-Multiple-improvements-of-ob-clojure-have-been-perfor.patch --]
[-- Type: text/plain, Size: 7921 bytes --]
From 3eb282c554f8099627b748e7c4eb07d0e810a2ae Mon Sep 17 00:00:00 2001
From: Frederick Giasson <fred@fgiasson.com>
Date: Mon, 14 Nov 2016 15:43:16 -0500
Subject: [PATCH] Multiple improvements of ob-clojure have been performed in
this commit.
(1) better error handling. Errors and exceptions are output in the results section of a org-mode document. They were silenced with the previous version.
(2) A new header parameter has been created: ":show-process" what will output the underlying NREPL processing in a new window + buffer
Note that the behavior of ob-clojure *did not change* with these modications.
Only the function (org-babel-execute:clojure) has been modified.
---
etc/ORG-NEWS | 32 ++++++++++++++++
lisp/ob-clojure.el | 105 +++++++++++++++++++++++++++++++++++++++++------------
2 files changed, 113 insertions(+), 24 deletions(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index a360e35..95c97a7 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -27,6 +27,38 @@ into
** New features
*** Horizontal rules are no longer ignored in LaTeX table math mode
+*** Org-babel-clojure :show-process
+
+A new block code header has been created for Org-babel-clojure that enables
+developers to output the process of an ongoing process into a new window/buffer.
+
+You can tell Org-babel-clojure to output the process of a running code block.
+
+To show that output you only have to specify the =:show-process= option
+in the code block's header like this:
+
+#+begin_example
+#+BEGIN_SRC clojure :results output :show-process
+ (dotimes [n 10]
+ (println n ".")
+ (Thread/sleep 500))
+#+END_SRC
+#+end_example
+
+If =:show-process= is specified that way, then when you will run the code using
+=C-c C-c= a new window will open in Emacs. Everything that is output
+by the REPL will immediately be added to that new window.
+
+When the processing of the code is finished, then the window and its
+buffer will be closed and the results will be reported in the
+=#+RESULTS= section.
+
+Note that the =:results= parameter's behavior is *not* changed. If
+=silent= is specified, then no result will be displayed. If =output= is
+specified then all the output from the window will appears in the results
+section. If =value= is specified, then only the last returned value of
+the code will be displayed in the results section.
+
* Version 9.0
diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
index 72ea77d..f78dd69 100644
--- a/lisp/ob-clojure.el
+++ b/lisp/ob-clojure.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2009-2016 Free Software Foundation, Inc.
-;; Author: Joel Boehland, Eric Schulte, Oleh Krehel
+;; Author: Joel Boehland, Eric Schulte, Oleh Krehel, Frederick Giasson
;;
;; Keywords: literate programming, reproducible research
;; Homepage: http://orgmode.org
@@ -84,34 +84,91 @@
body)))
(defun org-babel-execute:clojure (body params)
- "Execute a block of Clojure code with Babel."
+ "Execute a block of Clojure code with Babel.
+ The underlying process performed by the code block can be output
+ using the :show-process parameter."
(let ((expanded (org-babel-expand-body:clojure body params))
- result)
+ (sbuffer "*Clojure Show Process Sub Buffer*")
+ (show (assq :show-process params))
+ (response (list 'dict))
+ status
+ result)
(cl-case org-babel-clojure-backend
(cider
(require 'cider)
(let ((result-params (cdr (assq :result-params params))))
- (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")))))
- (slime
- (require 'slime)
- (with-temp-buffer
- (insert expanded)
- (setq result
- (slime-eval
- `(swank:eval-and-grab-output
- ,(buffer-substring-no-properties (point-min) (point-max)))
- (cdr (assq :package params)))))))
- (org-babel-result-cond (cdr (assq :result-params params))
- result
- (condition-case nil (org-babel-script-escape result)
- (error result)))))
+ ;; Check if the user want show the process in an output buffer/window.
+ (when show
+ ;; Create a new window with the show output buffer.
+ (switch-to-buffer-other-window sbuffer)
+
+ ;; Run the Clojure code in nREPL.
+ (nrepl-request:eval
+ expanded
+ (lambda (resp)
+ (when (member "out" resp)
+ ;; Print the output of the nREPL in the output buffer.
+ (princ (nrepl-dict-get resp "out") (get-buffer sbuffer)))
+ (when (member "ex" resp)
+ ;; In case there is an exception, then add it to the output buffer as well.
+ (princ (nrepl-dict-get resp "ex") (get-buffer sbuffer))
+ (princ (nrepl-dict-get resp "root-ex") (get-buffer sbuffer)))
+ (when (member "err" resp)
+ ;; In case there is an error, then add it to the output buffer as well.
+ (princ (nrepl-dict-get resp "err") (get-buffer sbuffer)))
+ (nrepl--merge response resp)
+ ;; Update the status of the nREPL output session.
+ (setq status (nrepl-dict-get response "status")))
+ (cider-current-connection)
+ (cider-current-session))
+
+ ;; Wait until the nREPL code finished to be processed.
+ (while (not (member "done" status))
+ (nrepl-dict-put response "status" (remove "need-input" status))
+ (accept-process-output nil 0.01)
+ (redisplay))
+
+ ;; Delete the show buffer & window when the processing is finalized.
+ (mapc #'delete-window (get-buffer-window-list sbuffer nil t))
+ (kill-buffer sbuffer)
+
+ ;; Put the output or the value in the result section of the code block.
+ (setq result (concat (nrepl-dict-get response
+ (if (or (member "output" result-params)
+ (member "pp" result-params))
+ "out"
+ "value"))
+ (nrepl-dict-get response "ex")
+ (nrepl-dict-get response "root-ex")
+ (nrepl-dict-get response "err"))))
+ ;; Check if user want to run code without showing the process.
+ (unless show
+ (setq response (let ((nrepl-sync-request-timeout
+ org-babel-clojure-sync-nrepl-timeout))
+ (nrepl-sync-request:eval
+ expanded (cider-current-connection) (cider-current-session))))
+ (setq result
+ (concat
+ (nrepl-dict-get response (if (or (member "output" result-params)
+ (member "pp" result-params))
+ "out"
+ "value"))
+ (nrepl-dict-get response "ex")
+ (nrepl-dict-get response "root-ex")
+ (nrepl-dict-get response "err"))))))
+ (slime
+ (require 'slime)
+ (with-temp-buffer
+ (insert expanded)
+ (setq result
+ (slime-eval
+ `(swank:eval-and-grab-output
+ ,(buffer-substring-no-properties (point-min) (point-max)))
+ (cdr (assq :package params)))))))
+ (org-babel-result-cond (cdr (assq :result-params params))
+ result
+ (condition-case nil (org-babel-script-escape result)
+ (error result)))))
(provide 'ob-clojure)
--
1.9.5.msysgit.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] New header parameter :show-process for Org-babel-clojure
2016-11-14 20:46 ` Frederick Giasson
@ 2016-11-15 7:49 ` Nicolas Goaziou
2016-11-17 13:39 ` Frederick Giasson
0 siblings, 1 reply; 16+ messages in thread
From: Nicolas Goaziou @ 2016-11-15 7:49 UTC (permalink / raw)
To: Frederick Giasson; +Cc: emacs-orgmode
Hello,
Frederick Giasson <fred@fgiasson.com> writes:
> I made all the changes requested and merged in a single commit. See
> the attachment.
Thank you.
> I did as of today. Waiting to get a reply from them on that.
Great! Please let me know once the process is complete, so that I can
apply your patch in master.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] New header parameter :show-process for Org-babel-clojure
2016-11-15 7:49 ` Nicolas Goaziou
@ 2016-11-17 13:39 ` Frederick Giasson
2016-11-17 23:06 ` Nicolas Goaziou
0 siblings, 1 reply; 16+ messages in thread
From: Frederick Giasson @ 2016-11-17 13:39 UTC (permalink / raw)
To: emacs-orgmode
Hi Nicolas,
> Great! Please let me know once the process is complete, so that I can
> apply your patch in master.
I am still waiting for FSF's signature. Should come in soon I guess.
Thanks,
Fred
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] New header parameter :show-process for Org-babel-clojure
2016-11-17 13:39 ` Frederick Giasson
@ 2016-11-17 23:06 ` Nicolas Goaziou
2016-11-18 15:03 ` Aaron Ecay
2016-11-18 15:12 ` Frederick Giasson
0 siblings, 2 replies; 16+ messages in thread
From: Nicolas Goaziou @ 2016-11-17 23:06 UTC (permalink / raw)
To: Frederick Giasson; +Cc: emacs-orgmode
Hello,
Frederick Giasson <fred@fgiasson.com> writes:
> I am still waiting for FSF's signature. Should come in soon I guess.
I applied your patch on a local branch, but compilation issues the
following warnings:
In toplevel form:
ob-clojure.el:86:1:Warning: Unused lexical variable `nrepl-sync-request-timeout'
In org-babel-execute:clojure:
ob-clojure.el:149:34:Warning: reference to free variable
`org-babel-clojure-sync-nrepl-timeout'
In end of data:
ob-clojure.el:180:1:Warning: the following functions are not known to be
defined: nrepl-request:eval, nrepl--merge, nrepl-dict-put
Could you look into it? In particular, "nrepl--merge" looks like an
internal function from nrepl. Is it safe to use it?
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] New header parameter :show-process for Org-babel-clojure
2016-11-17 23:06 ` Nicolas Goaziou
@ 2016-11-18 15:03 ` Aaron Ecay
2016-11-18 15:09 ` Frederick Giasson
2016-11-18 15:31 ` Frederick Giasson
2016-11-18 15:12 ` Frederick Giasson
1 sibling, 2 replies; 16+ messages in thread
From: Aaron Ecay @ 2016-11-18 15:03 UTC (permalink / raw)
To: Nicolas Goaziou, Frederick Giasson; +Cc: emacs-orgmode
Hi Nicolas, hi all,
2016ko azaroak 17an, Nicolas Goaziou-ek idatzi zuen:
>
> Hello,
>
> Frederick Giasson <fred@fgiasson.com> writes:
>
>> I am still waiting for FSF's signature. Should come in soon I guess.
>
> I applied your patch on a local branch, but compilation issues the
> following warnings:
>
> In toplevel form:
> ob-clojure.el:86:1:Warning: Unused lexical variable `nrepl-sync-request-timeout'
>
> In org-babel-execute:clojure:
> ob-clojure.el:149:34:Warning: reference to free variable
> `org-babel-clojure-sync-nrepl-timeout'
It looks like this warning results from a defcustom for this variable
not being included in the patch (and AFAICT it should be).
--
Aaron Ecay
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] New header parameter :show-process for Org-babel-clojure
2016-11-18 15:03 ` Aaron Ecay
@ 2016-11-18 15:09 ` Frederick Giasson
2016-11-18 15:49 ` Nicolas Goaziou
2016-11-18 15:31 ` Frederick Giasson
1 sibling, 1 reply; 16+ messages in thread
From: Frederick Giasson @ 2016-11-18 15:09 UTC (permalink / raw)
To: emacs-orgmode
Hi,
> It looks like this warning results from a defcustom for this variable
> not being included in the patch (and AFAICT it should be).
Humm, I thought that it was already part of Org-mode 8.x (something I
submitted a way back). Let me check that.
If I have to add it again, should I recreate the commit or simply submit
another patch?
Thanks,
Fred
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] New header parameter :show-process for Org-babel-clojure
2016-11-17 23:06 ` Nicolas Goaziou
2016-11-18 15:03 ` Aaron Ecay
@ 2016-11-18 15:12 ` Frederick Giasson
2016-11-18 15:51 ` Nicolas Goaziou
1 sibling, 1 reply; 16+ messages in thread
From: Frederick Giasson @ 2016-11-18 15:12 UTC (permalink / raw)
To: emacs-orgmode
Hi Nicolas,
> In end of data:
> ob-clojure.el:180:1:Warning: the following functions are not known to be
> defined: nrepl-request:eval, nrepl--merge, nrepl-dict-put
>
> Could you look into it? In particular, "nrepl--merge" looks like an
> internal function from nrepl. Is it safe to use it?
Yes, these functions are part of Cider's nrepl. Yes, they should be
safe. Also, they are only used in a context where the code block uses
Cider as the backend, so I guess it is right to use them in that
context. Thoughts?
Thanks,
Fred
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] New header parameter :show-process for Org-babel-clojure
2016-11-18 15:03 ` Aaron Ecay
2016-11-18 15:09 ` Frederick Giasson
@ 2016-11-18 15:31 ` Frederick Giasson
1 sibling, 0 replies; 16+ messages in thread
From: Frederick Giasson @ 2016-11-18 15:31 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 322 bytes --]
Hi Guys,
> It looks like this warning results from a defcustom for this variable
> not being included in the patch (and AFAICT it should be).
Sorry but I was confused. The documentation for this setting was
documented in Worg, but it was not yet part of the package.
Here is the commit related to that.
Thanks,
Fred
[-- Attachment #2: 0001-Adding-the-defcustom-for-the-org-babel-clojure-sync-.patch --]
[-- Type: text/plain, Size: 1020 bytes --]
From e68c5611f00eb37783205352d68efb7feccae8ab Mon Sep 17 00:00:00 2001
From: Frederick Giasson <fred@fgiasson.com>
Date: Fri, 18 Nov 2016 10:29:16 -0500
Subject: [PATCH] Adding the defcustom for the
"org-babel-clojure-sync-nrepl-timeout" variable used to configure the nrepl
execution timeout.
---
lisp/ob-clojure.el | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
index f78dd69..6dc9d90 100644
--- a/lisp/ob-clojure.el
+++ b/lisp/ob-clojure.el
@@ -56,6 +56,15 @@
(defvar org-babel-default-header-args:clojure '())
(defvar org-babel-header-args:clojure '((package . :any)))
+(defcustom org-babel-clojure-sync-nrepl-timeout 10
+ "Timeout value, in seconds, of a Clojure sync call.
+ If the value is nil, timeout is disabled."
+ :type 'integer
+ :version "25.1"
+ :package-version '(Org . "9.0")
+ :safe #'wholenump
+ :group 'org-babel)
+
(defcustom org-babel-clojure-backend
(cond ((featurep 'cider) 'cider)
(t 'slime))
--
1.9.5.msysgit.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] New header parameter :show-process for Org-babel-clojure
2016-11-18 15:09 ` Frederick Giasson
@ 2016-11-18 15:49 ` Nicolas Goaziou
2016-11-18 17:02 ` Frederick Giasson
0 siblings, 1 reply; 16+ messages in thread
From: Nicolas Goaziou @ 2016-11-18 15:49 UTC (permalink / raw)
To: Frederick Giasson; +Cc: emacs-orgmode
Hello,
Frederick Giasson <fred@fgiasson.com> writes:
> If I have to add it again, should I recreate the commit or simply
> submit another patch?
Could you recreate the commit so it is self-contained?
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] New header parameter :show-process for Org-babel-clojure
2016-11-18 15:12 ` Frederick Giasson
@ 2016-11-18 15:51 ` Nicolas Goaziou
0 siblings, 0 replies; 16+ messages in thread
From: Nicolas Goaziou @ 2016-11-18 15:51 UTC (permalink / raw)
To: Frederick Giasson; +Cc: emacs-orgmode
Hello,
Frederick Giasson <fred@fgiasson.com> writes:
> Hi Nicolas,
>> In end of data:
>> ob-clojure.el:180:1:Warning: the following functions are not known to be
>> defined: nrepl-request:eval, nrepl--merge, nrepl-dict-put
>>
>> Could you look into it? In particular, "nrepl--merge" looks like an
>> internal function from nrepl. Is it safe to use it?
>
> Yes, these functions are part of Cider's nrepl. Yes, they should be
> safe. Also, they are only used in a context where the code block uses
> Cider as the backend, so I guess it is right to use them in that
> context. Thoughts?
They should be declared at the beginning of "ob-clojure.el" (see
nrep-dict-get for example).
Also an internal function means its signature can change, or it can be
removed, without prior notice. If there is no "public" API for
"nrepl--merge", then so be it.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] New header parameter :show-process for Org-babel-clojure
2016-11-18 15:49 ` Nicolas Goaziou
@ 2016-11-18 17:02 ` Frederick Giasson
2016-11-19 7:40 ` Nicolas Goaziou
0 siblings, 1 reply; 16+ messages in thread
From: Frederick Giasson @ 2016-11-18 17:02 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 106 bytes --]
Hi Nicolas,
> Could you recreate the commit so it is self-contained?
That should be it.
Thanks,
Fred
[-- Attachment #2: 0001-Multiple-improvements-of-ob-clojure-have-been-perfor.patch --]
[-- Type: text/plain, Size: 9679 bytes --]
From e19c358f9d4cab9b22c3e4e3bf6b8f6298e61b0e Mon Sep 17 00:00:00 2001
From: Frederick Giasson <fred@fgiasson.com>
Date: Fri, 18 Nov 2016 12:01:02 -0500
Subject: [PATCH] Multiple improvements of ob-clojure have been performed in
this commit.
(1) better error handling. Errors and exceptions are output in the results section of a org-mode document. They were silenced with the previous version.
(2) A new header parameter has been created: ":show-process" what will output the underlying NREPL processing in a new window + buffer
(3) new setting "org-babel-clojure-sync-nrepl-timeout" to specify the Cider nrepl timeout. 'nil' means that it will never timeout
Note that the behavior of ob-clojure *did not change* with these modications.
Only the function (org-babel-execute:clojure) has been modified.
---
etc/ORG-NEWS | 42 ++++++++++++++++++-
lisp/ob-clojure.el | 117 ++++++++++++++++++++++++++++++++++++++++++-----------
2 files changed, 134 insertions(+), 25 deletions(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index a360e35..5a5be53 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -23,8 +23,48 @@ into
: (file (lambda () (sexp)))
-
** New features
+*** Babel
+**** Org-babel-clojure, new setting 'org-babel-clojure-sync-nrepl-timeout'
+
+Creation of a new setting to specify the Cider timeout. By setting the =org-babel-clojure-sync-nrepl-timeout=
+setting option. The value is in seconds and if set to =nil= then no timeout will occur.
+
+#+BEGIN_SRC emacs-lisp
+ ; Disable Cider's timeout
+ (setq org-babel-clojure-sync-nrepl-timeout nil)
+
+ ; Set the timeout to 20 seconds
+ (setq org-babel-clojure-sync-nrepl-timeout 20)
+#+END_SRC
+
+
+**** Org-babel-clojure :show-process
+A new block code header has been created for Org-babel-clojure that enables developers to output the process of an ongoing process into a new window/buffer.
+
+You can tell Org-babel-clojure to output the process of a running code block.
+
+To show that output you only have to specify the =:show-process= option in the code block's header like this:
+
+#+begin_example
+#+BEGIN_SRC clojure :results output :show-process
+ (dotimes [n 10]
+ (println n ".")
+ (Thread/sleep 500))
+#+END_SRC
+#+end_example
+
+If =:show-process= is specified that way, then when you will run the
+code using =C-c C-c= a new window will open in Emacs. Everything that is
+output by the REPL will immediately be added to that new window.
+
+When the processing of the code is finished, then the window and its buffer will be closed and the results will be reported in the
+=#+RESULTS= section.
+
+Note that the =:results= parameter's behavior is *not* changed. If =silent= is specified, then no result will be displayed. If =output= is
+specified then all the output from the window will appears in the
+results section. If =value= is specified, then only the last returned
+value of the code will be displayed in the results section.
*** Horizontal rules are no longer ignored in LaTeX table math mode
diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
index 72ea77d..070e0ca 100644
--- a/lisp/ob-clojure.el
+++ b/lisp/ob-clojure.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2009-2016 Free Software Foundation, Inc.
-;; Author: Joel Boehland, Eric Schulte, Oleh Krehel
+;; Author: Joel Boehland, Eric Schulte, Oleh Krehel, Frederick Giasson
;;
;; Keywords: literate programming, reproducible research
;; Homepage: http://orgmode.org
@@ -45,6 +45,9 @@
(declare-function cider-current-connection "ext:cider-client" (&optional type))
(declare-function cider-current-session "ext:cider-client" ())
(declare-function nrepl-dict-get "ext:nrepl-client" (dict key))
+(declare-function nrepl-dict-put "ext:nrepl-client" (dict key value))
+(declare-function nrepl--merge "ext:nrepl-client" (dict1 dict2))
+(declare-function nrepl-request:eval "ext:nrepl-client" (input callback connection))
(declare-function nrepl-sync-request:eval "ext:nrepl-client"
(input connection session &optional ns))
(declare-function org-trim "org" (s &optional keep-lead))
@@ -56,6 +59,15 @@
(defvar org-babel-default-header-args:clojure '())
(defvar org-babel-header-args:clojure '((package . :any)))
+(defcustom org-babel-clojure-sync-nrepl-timeout 10
+ "Timeout value, in seconds, of a Clojure sync call.
+ If the value is nil, timeout is disabled."
+ :type 'integer
+ :version "25.1"
+ :package-version '(Org . "9.0")
+ :safe #'wholenump
+ :group 'org-babel)
+
(defcustom org-babel-clojure-backend
(cond ((featurep 'cider) 'cider)
(t 'slime))
@@ -84,34 +96,91 @@
body)))
(defun org-babel-execute:clojure (body params)
- "Execute a block of Clojure code with Babel."
+ "Execute a block of Clojure code with Babel.
+ The underlying process performed by the code block can be output
+ using the :show-process parameter."
(let ((expanded (org-babel-expand-body:clojure body params))
- result)
+ (sbuffer "*Clojure Show Process Sub Buffer*")
+ (show (assq :show-process params))
+ (response (list 'dict))
+ status
+ result)
(cl-case org-babel-clojure-backend
(cider
(require 'cider)
(let ((result-params (cdr (assq :result-params params))))
- (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")))))
- (slime
- (require 'slime)
- (with-temp-buffer
- (insert expanded)
- (setq result
- (slime-eval
- `(swank:eval-and-grab-output
- ,(buffer-substring-no-properties (point-min) (point-max)))
- (cdr (assq :package params)))))))
- (org-babel-result-cond (cdr (assq :result-params params))
- result
- (condition-case nil (org-babel-script-escape result)
- (error result)))))
+ ;; Check if the user want show the process in an output buffer/window.
+ (when show
+ ;; Create a new window with the show output buffer.
+ (switch-to-buffer-other-window sbuffer)
+
+ ;; Run the Clojure code in nREPL.
+ (nrepl-request:eval
+ expanded
+ (lambda (resp)
+ (when (member "out" resp)
+ ;; Print the output of the nREPL in the output buffer.
+ (princ (nrepl-dict-get resp "out") (get-buffer sbuffer)))
+ (when (member "ex" resp)
+ ;; In case there is an exception, then add it to the output buffer as well.
+ (princ (nrepl-dict-get resp "ex") (get-buffer sbuffer))
+ (princ (nrepl-dict-get resp "root-ex") (get-buffer sbuffer)))
+ (when (member "err" resp)
+ ;; In case there is an error, then add it to the output buffer as well.
+ (princ (nrepl-dict-get resp "err") (get-buffer sbuffer)))
+ (nrepl--merge response resp)
+ ;; Update the status of the nREPL output session.
+ (setq status (nrepl-dict-get response "status")))
+ (cider-current-connection)
+ (cider-current-session))
+
+ ;; Wait until the nREPL code finished to be processed.
+ (while (not (member "done" status))
+ (nrepl-dict-put response "status" (remove "need-input" status))
+ (accept-process-output nil 0.01)
+ (redisplay))
+
+ ;; Delete the show buffer & window when the processing is finalized.
+ (mapc #'delete-window (get-buffer-window-list sbuffer nil t))
+ (kill-buffer sbuffer)
+
+ ;; Put the output or the value in the result section of the code block.
+ (setq result (concat (nrepl-dict-get response
+ (if (or (member "output" result-params)
+ (member "pp" result-params))
+ "out"
+ "value"))
+ (nrepl-dict-get response "ex")
+ (nrepl-dict-get response "root-ex")
+ (nrepl-dict-get response "err"))))
+ ;; Check if user want to run code without showing the process.
+ (unless show
+ (setq response (let ((nrepl-sync-request-timeout
+ org-babel-clojure-sync-nrepl-timeout))
+ (nrepl-sync-request:eval
+ expanded (cider-current-connection) (cider-current-session))))
+ (setq result
+ (concat
+ (nrepl-dict-get response (if (or (member "output" result-params)
+ (member "pp" result-params))
+ "out"
+ "value"))
+ (nrepl-dict-get response "ex")
+ (nrepl-dict-get response "root-ex")
+ (nrepl-dict-get response "err"))))))
+ (slime
+ (require 'slime)
+ (with-temp-buffer
+ (insert expanded)
+ (setq result
+ (slime-eval
+ `(swank:eval-and-grab-output
+ ,(buffer-substring-no-properties (point-min) (point-max)))
+ (cdr (assq :package params)))))))
+ (org-babel-result-cond (cdr (assq :result-params params))
+ result
+ (condition-case nil (org-babel-script-escape result)
+ (error result)))))
(provide 'ob-clojure)
--
1.9.5.msysgit.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] New header parameter :show-process for Org-babel-clojure
2016-11-18 17:02 ` Frederick Giasson
@ 2016-11-19 7:40 ` Nicolas Goaziou
0 siblings, 0 replies; 16+ messages in thread
From: Nicolas Goaziou @ 2016-11-19 7:40 UTC (permalink / raw)
To: Frederick Giasson; +Cc: emacs-orgmode
Hello,
Frederick Giasson <fred@fgiasson.com> writes:
>> Could you recreate the commit so it is self-contained?
>
> That should be it.
Thank you. I applied your patch with the following changes:
- I wrote a proper (according to our usage) commit message;
- I slightly refactored the code;
- I required an expected value for :show-process, much like other head
arguments. So a bare ":show-process" means ":show-process nil" and,
therefore, doesn't show process. Use ":show-process t" instead.
BTW, could you document the new feature in
<http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html>?
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2016-11-19 7:40 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-07 19:19 [PATCH] New header parameter :show-process for Org-babel-clojure Frederick Giasson
2016-11-10 15:18 ` Nicolas Goaziou
2016-11-10 17:20 ` Frederick Giasson
2016-11-10 23:55 ` Nicolas Goaziou
2016-11-14 20:46 ` Frederick Giasson
2016-11-15 7:49 ` Nicolas Goaziou
2016-11-17 13:39 ` Frederick Giasson
2016-11-17 23:06 ` Nicolas Goaziou
2016-11-18 15:03 ` Aaron Ecay
2016-11-18 15:09 ` Frederick Giasson
2016-11-18 15:49 ` Nicolas Goaziou
2016-11-18 17:02 ` Frederick Giasson
2016-11-19 7:40 ` Nicolas Goaziou
2016-11-18 15:31 ` Frederick Giasson
2016-11-18 15:12 ` Frederick Giasson
2016-11-18 15:51 ` Nicolas Goaziou
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).