mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-21 06:55:35 +00:00
ob-clojure.el: Fix comments getting deleted on tangling of clojure source blocks
* lisp/ob-clojure.el (org-babel-expand-body:clojure): Leave the comments intact if the code block does not have :var. Reported-by: "Anoop G R" <anoopemacs@gmail.com> Link: https://list.orgmode.org/874j5azk2p.fsf@localhost/T/#t TINYCHANGE
This commit is contained in:
parent
566c341155
commit
23eb697df6
@ -155,21 +155,21 @@ or set the `:backend' header argument"))))
|
|||||||
(result-params (cdr (assq :result-params params)))
|
(result-params (cdr (assq :result-params params)))
|
||||||
(print-level nil)
|
(print-level nil)
|
||||||
(print-length nil)
|
(print-length nil)
|
||||||
;; Remove comments, they break (let [...] ...) bindings
|
|
||||||
(body (replace-regexp-in-string "^[ ]*;+.*$" "" body))
|
|
||||||
(body (org-trim
|
(body (org-trim
|
||||||
(concat
|
(concat
|
||||||
;; Source block specified namespace :ns.
|
;; Source block specified namespace :ns.
|
||||||
(and (cdr (assq :ns params)) (format "(ns %s)\n" ns))
|
(and (cdr (assq :ns params)) (format "(ns %s)\n" ns))
|
||||||
;; Variables binding.
|
;; Variables binding.
|
||||||
(if (null vars) (org-trim body)
|
(if (null vars) (org-trim body)
|
||||||
(format "(let [%s]\n%s)"
|
;; Remove comments, they break (let [...] ...) bindings
|
||||||
|
(let ((body (replace-regexp-in-string "^[ ]*;+.*$" "" body)))
|
||||||
|
(format "(let [%s]\n%s)"
|
||||||
(mapconcat
|
(mapconcat
|
||||||
(lambda (var)
|
(lambda (var)
|
||||||
(format "%S '%S" (car var) (cdr var)))
|
(format "%S '%S" (car var) (cdr var)))
|
||||||
vars
|
vars
|
||||||
"\n ")
|
"\n ")
|
||||||
body))))))
|
body)))))))
|
||||||
;; If the result param is set to "output" we don't have to do
|
;; If the result param is set to "output" we don't have to do
|
||||||
;; anything special and just let the backend handle everything
|
;; anything special and just let the backend handle everything
|
||||||
(if (member "output" result-params)
|
(if (member "output" result-params)
|
||||||
|
Loading…
Reference in New Issue
Block a user