Comments were only removed when `vars' were provided, and still broke
`(let [...] ...)' otherwise, and so, executing any Clojure src block
which ends in a comment would fail without explanation.

This fix uses the existing solution, but uses it regardless of `vars',
causing comments to correctly be ignored during execution, and for
execution of blocks ending in comments to work as expected.
From 8a6732213ef8c9118dee4a4fb2f9dd2b17a770d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?L=C4=93ctia=20Landau?= <[email protected]>
Date: Wed, 29 Jul 2026 02:26:32 +0300
Subject: [PATCH] lisp/ob-clojure.el: Fix executing blocks ending in comments

* ob-clojure.el (org-babel-expand-body:clojure): Remove comments
  regardless of `vars'.

Comments were only removed when `vars' were provided, and still broke
`(let [...] ...)' otherwise, and so, executing any Clojure src block
which ends in a comment would fail without explanation.

This fix uses the existing solution, but uses it regardless of `vars',
causing comments to correctly be ignored during execution, and for
execution of blocks ending in comments to work as expected.

TINYCHANGE
---
 lisp/ob-clojure.el | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
index f5ac5c7c..9d8c4766 100644
--- a/lisp/ob-clojure.el
+++ b/lisp/ob-clojure.el
@@ -156,11 +156,11 @@ or set the `:backend' header argument"))))
      (concat
       ;; Source block specified namespace :ns.
       (and (cdr (assq :ns params)) (format "(ns %s)\n" ns))
-      ;; Variables binding.
-      (if (null vars) (org-trim body)
-        ;; Remove comments, they break (let [...] ...) bindings
-        (let ((body (replace-regexp-in-string "^[    ]*;+.*$" "" body)))
-          (format "(let [%s]\n%s)"
+      ;; Remove comments, they break (let [...] ...) bindings
+      (let ((body (replace-regexp-in-string "^[    ]*;+.*$" "" body)))
+        ;; Variables binding.
+        (if (null vars) (org-trim body)
+          (format "(let [%s]\n%s\n)"
                   (mapconcat
                    (lambda (var)
                      (format "%S '%S" (car var) (cdr var)))
-- 
2.55.0

Reply via email to