>From dab6472228d1a0a41831dcae969335d0a7fb7531 Mon Sep 17 00:00:00 2001 From: Frederick Giasson Date: Wed, 6 Apr 2016 10:46:35 -0400 Subject: [PATCH 2/2] Addition of a new customization variable called "org-babel-clojure-sync-nrepl-timeout" which expose the Cider timeout setting as a custom variable. The timeout is in second, and if nil is specified and timeout is disabled. With previous version, the timeout was set to 10 seconds, and if you were running a function that was taking more than 10 seconds, then you were getting a nREPL timeout error. This is why it is important to expose that setting to the org-mode users. --- lisp/ob-clojure.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el index 89a09a9..86f1cff 100644 --- a/lisp/ob-clojure.el +++ b/lisp/ob-clojure.el @@ -56,6 +56,12 @@ (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 + :group 'org-babel) + (defcustom org-babel-clojure-backend (cond ((featurep 'cider) 'cider) (t 'slime)) @@ -94,8 +100,9 @@ (let ((result-params (cdr (assoc :result-params params)))) (setq result (nrepl-dict-get - (nrepl-sync-request:eval - expanded (cider-current-connection) (cider-current-session)) + (let ((nrepl-sync-request-timeout org-babel-clojure-sync-nrepl-timeout)) + (nrepl-sync-request:eval + expanded (cider-current-connection) (cider-current-session))) (if (or (member "output" result-params) (member "pp" result-params)) "out" -- 1.9.5.msysgit.0