Hi! I had a look and apparently cider-eval returns nil when the expression is a comment, vs the string "nil" when the Clojure expression returns nil. Simply filtering nil values out seems to have fixed the issue for me. @Christopher, can you check the attached patch if this works for you?
@Ihor, a few developer related questions: - I wanted to add a test, how can I run only test-ob-clojure? I don't think the tests work currently and I would fix them and add more. - What should I use for indention? Looking in ob-clojure and org.el it seems that using tabs with tab-width 8 is standard but there's quite a few lines where it's spaces only. - If this simple patch for example or fixing tests is good, should I just install it? Can I "freely" install minor changes to ob-clojure or should everything go over the mailinglist? Thanks. I hope I can work a bit more on ob-clojure the next few days, I think I missed a few emails, sorry. Now I have a filter rule where mails with Clojure in the subject go to my inbox. Cheers, Daniel
>From 87054023df0876d17771ee3885e7b1091ccdeab1 Mon Sep 17 00:00:00 2001 From: Daniel Kraus <dan...@kraus.my> Date: Thu, 27 Oct 2022 14:16:33 +0200 Subject: [PATCH] lisp/ob-clojure.el: Fix bug with inline comments * lisp/ob-clojure.el (ob-clojure-eval-with-cider): Filter out nil values from cider evaluation. --- lisp/ob-clojure.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el index 0649469b3..eff8d04e4 100644 --- a/lisp/ob-clojure.el +++ b/lisp/ob-clojure.el @@ -239,7 +239,7 @@ or set the `:backend' header argument")))) result0))) (ob-clojure-string-or-list (reverse (delete "" (mapcar (lambda (r) - (replace-regexp-in-string "nil" "" r)) + (replace-regexp-in-string "nil" "" (or r ""))) result0))))))) (defun ob-clojure-eval-with-slime (expanded params) -- 2.38.1
Ihor Radchenko <yanta...@posteo.net> writes: > "Christopher M. Miles" <numbch...@gmail.com> writes: > >> I have following Clojure source block: >> >> #+begin_src clojure >> (re-find #"\d+" "I've just finished reading Fahrenheit 451");; => "451" >> (re-find #"Bees" "Beads aren't cheap.");; => nil >> #+end_src >> >> When I press =[C-c C-c]= to evaluate source block, got error: >> >> When there is no comments behind code lines. No this error. >> >> #+begin_example >> Debugger entered--Lisp error: (wrong-type-argument arrayp nil) >> replace-regexp-in-string("nil" "" nil) > > Daniel, could you please take a look?