From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id cCJyBawvD2QIXQAASxT56A (envelope-from ) for ; Mon, 13 Mar 2023 15:14:04 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id +L9bBawvD2SlWAEAauVa8A (envelope-from ) for ; Mon, 13 Mar 2023 15:14:04 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 94F14F6DF for ; Mon, 13 Mar 2023 15:14:02 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbivL-0001Zb-TU; Mon, 13 Mar 2023 10:13:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pbivJ-0001Wu-9g for emacs-orgmode@gnu.org; Mon, 13 Mar 2023 10:13:13 -0400 Received: from mout-p-103.mailbox.org ([2001:67c:2050:0:465::103]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1pbivF-0006vP-LG for emacs-orgmode@gnu.org; Mon, 13 Mar 2023 10:13:12 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4PZzBs134dz9sT5; Mon, 13 Mar 2023 15:12:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kraus.my; s=MBO0001; t=1678716773; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HPQtBOPYeaKeytKxaqEgnYjEsOWpnNuNA2p20RbH3Xc=; b=04eLnorcstM/xE4D/bCTGkvCPdqagAEpNLtLZCBwdIfZCUa5+F79MbUfQAUZQYet73DoSW x9DYKKwa3BeE+gk1kZFE2sc2DBI4cEdQKvH9ORiKdEtoonajJsxqRbjRNkrvHJr00gW4H6 PhWOg9sX+pFYjTyBo3niIL1ln5oQztrk7eR7GE64q3QYjQMIgP8Bqi6HmIjWvVrbbD5lOk pf5MqTlK6v1lk4ZciNbapvzsRW0H/uq3leLc+euC2HSHsq4QX/eVAgUyRzs+tOx28nV7FK ItEpXehlrXtEhmwInTLwXH9QLvedkYrRthdPE3neviEu2OcN1epv7fkRFEpIXQ== References: <87mt4m53qj.fsf@kraus.my> <87pm9gyebl.fsf@localhost> From: Daniel Kraus To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: [patch] ob-clojure: Fix results output Date: Mon, 13 Mar 2023 15:01:11 +0100 In-reply-to: <87pm9gyebl.fsf@localhost> Message-ID: <877cvkhh9d.fsf@kraus.my> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: none client-ip=2001:67c:2050:0:465::103; envelope-from=daniel@kraus.my; helo=mout-p-103.mailbox.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=kraus.my header.s=MBO0001 header.b=04eLnorc; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1678716843; a=rsa-sha256; cv=none; b=uLwG8/nyVGmCyMStIsOzaNmLYFaTKN3UpmTF5jZASWaHwH3TvvzKwLZyHISH/4Vdt33l/+ fV3cvTSZegtJ1uSNyqeRlh/NZ8OaQLxnmWtdkcimxfGg0i1KWoFZ54bu/sA2rF3XE+w3V7 34OZCi5iMi7rpGwj/7LpEetR3NY+pnpo9Gwla6GFNnz+eRhGZpFlTbsvad79/1ccgOg4hB qz2l88B8oAtKQg8Zp+4kqUVdUT4dy56h0u7wusChGylKLVksmYVgOIH6Z4vBDzMgxJWb19 9AcYR1uvINjWvoJ9Pb2FaFTsIOPERFxsSYjkHf47/jI8xXGI62wqsGhfkPsLYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1678716843; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=HPQtBOPYeaKeytKxaqEgnYjEsOWpnNuNA2p20RbH3Xc=; b=r+m2fpehLREaeQByiyqaD/pLIxAle5SXSR24uTuvoSVrQIGdxxvdcLuZ+K+olQy9Vzktue eByfYAdCmjbJ4NGc27xasShXBF1Tm+tFSggMyzLP0+r68n0rnZDHmrvwAUabGDYGaYEPX2 V0VDuziiyE6OPdBu9XTng2glt5jMVvin50YHfK+rOGh/ZqCEp31ve/3TT/AHg9DRyXkjxp AMxapyytXvw/PFUrKcqnK6BGuXh1lAXBpUE1BuntSMyFxsyedGcOxX0JeK14OC+jjGAD1S hJynY0N4wtljAfvwM4xbGzFg4YTNSKuKWTrdnynX7sNnrtipKfyAbnfVl+nHKQ== X-Migadu-Spam-Score: -3.82 X-Spam-Score: -3.82 X-Migadu-Queue-Id: 94F14F6DF X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=kraus.my header.s=MBO0001 header.b=04eLnorc; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=none X-TUID: xmRt/vlOpbY2 --=-=-= Content-Type: text/plain Hi! Ihor Radchenko writes: > You need to document the changes in ORG-NEWS. I added an entry about the new ClojureScript change. I guess the other (main) part of the patch is a bugfix and will not be documented in ORG-NEWS. > Also, see inline comments below. > >> Subject: [PATCH] ob-clojure.el: Fix results output, support clojure-cli > > Does it have to be a single commit? Not a big deal, but two separate > commits would be cleaner. I saw that as well but unfortunately I did it all in the same go and then touch the same code parts, so separating them in individual working commits, while not a huge task, is still some work with not much benefit. >> -;; Support for evaluating Clojure code >> +;; Support for evaluating Clojure / ClojureScript code. > > This is an important new feature that should be announced clearly in ORG-NEWS. ClojureScript source blocks where supported before, but just no way to set the backend for it separately. See the ORG-NEWS in the new attached patch. > Also, make sure that > https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html > is up-to-date. Good reminder. I send a PR for this when this patch is installed?! >> (defcustom org-babel-clojure-backend (cond >> ((executable-find "bb") 'babashka) >> - ((executable-find "nbb") 'nbb) >> + ((executable-find "clojure") 'clojure-cli) >> ((featurep 'cider) 'cider) >> ((featurep 'inf-clojure) 'inf-clojure) >> ((featurep 'slime) 'slime) >> @@ -87,11 +88,24 @@ defcustom org-babel-clojure-backend >> :group 'org-babel >> :package-version '(Org . "9.6") > > Org 9.7. This is a new feature to come in the next release. Fixed. >> +(defcustom org-babel-clojurescript-backend >> + (cond >> + ((or (executable-find "nbb") (executable-find "npx")) 'nbb) >> + ((featurep 'cider) 'cider) >> + (t nil)) >> + "Backend used to evaluate Clojure code blocks." >> + :group 'org-babel >> + :package-version '(Org . "9.6") > > 9.7 > New customization to be announced in ORG-NEWS. Fixed. >> -(defcustom ob-clojure-nbb-command (executable-find "nbb") >> +(defcustom ob-clojure-nbb-command (or (executable-find "nbb") >> + (when-let (npx (executable-find "npx")) >> + (concat npx " nbb"))) >> "Path to the nbb executable." >> :type '(choice file (const nil)) >> + :group 'org-babel) > > It is no longer a path, despite what is claimed in the docstring. > :type definition is also not accurate. > Also, update :package-version. Fixed. >> +(defcustom ob-clojure-cli-command (when-let (cmd (executable-find "clojure")) >> + (concat cmd " -M")) >> + "Clojure CLI command used to execute source blocks." >> + :type 'file >> :group 'org-babel >> :package-version '(Org . "9.6")) > > 9.7 Fixed. >> (defun org-babel-expand-body:clojure (body params) >> "Expand BODY according to PARAMS, return the expanded body." >> (let* ((vars (org-babel--get-vars params)) >> + (cljs-p (string= (cdr (assq :target params)) "cljs")) > > Note: I do not see :target header arg being documented in > https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html This was apparently a kludge that ob-clojure used to evaluate ClojureScript in the normal clojure:execute function. I simply used the same kludge where I need to check for cljs, but after reviewing it's not really necessary and I removed the :target parameter completely. As this was undocumented I guess it's ok to remove?! >> -(defun ob-clojure-eval-with-babashka (bb expanded) >> - "Evaluate EXPANDED code block using BB (babashka or nbb)." >> - (let ((script-file (org-babel-temp-file "clojure-bb-script-" ".clj"))) > > This will remove a non-private function. May you leave a fallback > obsolete alias to not break third-party code that calls the old function > name? I created an obsolete-function-alias. Attached is the new patch with the changes. Thanks, Daniel --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-ob-clojure.el-Fix-results-output-support-clojure-cli.patch >From 3ad98fa88f6ebd4ae1b2b41d66cca9e9d6e1875e Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Thu, 9 Mar 2023 16:11:27 +0100 Subject: [PATCH] ob-clojure.el: Fix results output, support clojure-cli * lisp/ob-clojure.el (org-babel-clojure-backend): Add support for clojure-cli. * lisp/ob-clojure.el (org-babel-clojurescript-backend): Move nbb to clojurescript. * lisp/ob-clojure.el (org-babel-expand-body:clojure) * lisp/ob-clojure.el (ob-clojure-eval-with-cider): Return only the last expression when :results is not set or value, and return only stdout when :results is set to output. * lisp/ob-clojure.el (ob-clojure-eval-with-cmd): Rename function as it is not only for babashka. * lisp/ob-clojure.el (org-babel-execute:clojure): Differentiate between Clojure and ClojureScript source blocks. The problem was that the ob-clojure results where not correctly taking the results parameter into account. E.g. with the cider backend, you would get all printed or returned values for each line in your block: (def small-map {:a 2 :b 4 :c 8}) {:some :map} (prn :xx) (:b small-map) | #'user/small-map | | {:some :map} | | 4 | or for babashka you would only get the printed values but not the last return value: (def small-map {:a 2 :b 4 :c 8}) {:some :map} (prn :xx) (:b small-map) : :xx Now when you specify :results value, the result is only the last returned value, and with :results output you get all values printed to stdout. So the examples above would all result in the same: (def small-map {:a 2 :b 4 :c 8}) {:some :map} (prn :xx) (:b small-map) : 4 --- etc/ORG-NEWS | 9 +++ lisp/ob-clojure.el | 150 ++++++++++++++++++++++++++++----------------- 2 files changed, 104 insertions(+), 55 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index b9d7b3459..3319de0a1 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -96,6 +96,15 @@ The face ~org-agenda-calendar-daterange~ is used to show entries with a date range in the agenda. It inherits from the default face in order to remain backward-compatible. +*** New ~org-babel-clojurescript-backend~ option to choose ClojureScript backend + +Before, a ClojureScript source block used the same backend as Clojure, +configured in ~org-babel-clojure-backend~ and relied on an undocumented +~:target~ paramter. + +Now, there's ~org-babel-clojurescript-backend~ to determine the +backend used for evaluation of ClojureScript. + ** New features *** ~org-metaup~ and ~org-metadown~ now act on headings in region diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el index 5f589db00..8ae1395d2 100644 --- a/lisp/ob-clojure.el +++ b/lisp/ob-clojure.el @@ -25,20 +25,21 @@ ;;; Commentary: -;; Support for evaluating Clojure code +;; Support for evaluating Clojure / ClojureScript code. ;; Requirements: ;; - Clojure (at least 1.2.0) ;; - clojure-mode -;; - inf-clojure, Cider, SLIME, babashka or nbb +;; - babashka, nbb, Clojure CLI tools, Cider, inf-clojure or SLIME ;; For clojure-mode, see https://github.com/clojure-emacs/clojure-mode -;; For inf-clojure, see https://github.com/clojure-emacs/inf-clojure -;; For Cider, see https://github.com/clojure-emacs/cider -;; For SLIME, see https://slime.common-lisp.dev ;; For babashka, see https://github.com/babashka/babashka ;; For nbb, see https://github.com/babashka/nbb +;; For Clojure CLI tools, see https://clojure.org/guides/deps_and_cli +;; For Cider, see https://github.com/clojure-emacs/cider +;; For inf-clojure, see https://github.com/clojure-emacs/inf-clojure +;; For SLIME, see https://slime.common-lisp.dev ;; For SLIME, the best way to install its components is by following ;; the directions as set out by Phil Hagelberg (Technomancy) on the @@ -78,20 +79,33 @@ defvar org-babel-header-args:clojurescript (defcustom org-babel-clojure-backend (cond ((executable-find "bb") 'babashka) - ((executable-find "nbb") 'nbb) + ((executable-find "clojure") 'clojure-cli) ((featurep 'cider) 'cider) ((featurep 'inf-clojure) 'inf-clojure) ((featurep 'slime) 'slime) (t nil)) "Backend used to evaluate Clojure code blocks." :group 'org-babel - :package-version '(Org . "9.6") + :package-version '(Org . "9.7") :type '(choice - (const :tag "inf-clojure" inf-clojure) + (const :tag "babashka" babashka) + (const :tag "clojure-cli" clojure-cli) (const :tag "cider" cider) + (const :tag "inf-clojure" inf-clojure) (const :tag "slime" slime) - (const :tag "babashka" babashka) + (const :tag "Not configured yet" nil))) + +(defcustom org-babel-clojurescript-backend + (cond + ((or (executable-find "nbb") (executable-find "npx")) 'nbb) + ((featurep 'cider) 'cider) + (t nil)) + "Backend used to evaluate Clojure code blocks." + :group 'org-babel + :package-version '(Org . "9.7") + :type '(choice (const :tag "nbb" nbb) + (const :tag "cider" cider) (const :tag "Not configured yet" nil))) (defcustom org-babel-clojure-default-ns "user" @@ -105,14 +119,24 @@ defcustom ob-clojure-babashka-command :group 'org-babel :package-version '(Org . "9.6")) -(defcustom ob-clojure-nbb-command (executable-find "nbb") +(defcustom ob-clojure-nbb-command (or (executable-find "nbb") + (when-let (npx (executable-find "npx")) + (concat npx " nbb"))) "Path to the nbb executable." - :type '(choice file (const nil)) + :type '(choice string (const nil)) :group 'org-babel - :package-version '(Org . "9.6")) + :package-version '(Org . "9.7")) -(defun org-babel-expand-body:clojure (body params) - "Expand BODY according to PARAMS, return the expanded body." +(defcustom ob-clojure-cli-command (when-let (cmd (executable-find "clojure")) + (concat cmd " -M")) + "Clojure CLI command used to execute source blocks." + :type 'string + :group 'org-babel + :package-version '(Org . "9.7")) + +(defun org-babel-expand-body:clojure (body params &optional cljs-p) + "Expand BODY according to PARAMS, return the expanded body. +When CLJS-P is non-nil, expand in a cljs context instead of clj." (let* ((vars (org-babel--get-vars params)) (backend-override (cdr (assq :backend params))) (org-babel-clojure-backend @@ -146,10 +170,26 @@ defun org-babel-expand-body:clojure vars "\n ") body)))))) - (if (or (member "code" result-params) - (member "pp" result-params)) - (format "(clojure.pprint/pprint (do %s))" body) - body))) + ;; If the result param is set to "output" we don't have to do + ;; anything special and just let the backend handle everything + (if (member "output" result-params) + body + + ;; If the result is not "output" (i.e. it's "value"), disable + ;; stdout output and print the last returned value. Use pprint + ;; instead of prn when results param is "pp" or "code". + (concat + (if (or (member "code" result-params) + (member "pp" result-params)) + (concat (if cljs-p + "(require '[cljs.pprint :refer [pprint]])" + "(require '[clojure.pprint :refer [pprint]])") + " (pprint ") + "(prn ") + (if cljs-p + "(binding [cljs.core/*print-fn* (constantly nil)]" + "(binding [*out* (java.io.StringWriter.)]") + body "))")))) (defvar ob-clojure-inf-clojure-filter-out) (defvar ob-clojure-inf-clojure-tmp-output) @@ -225,32 +265,19 @@ defun ob-clojure-eval-with-inf-clojure s)) (reverse ob-clojure-inf-clojure-tmp-output))))) -(defun ob-clojure-eval-with-cider (expanded params) - "Evaluate EXPANDED code block with PARAMS using cider." +(defun ob-clojure-eval-with-cider (expanded params &optional cljs-p) + "Evaluate EXPANDED code block with PARAMS using cider. +When CLJS-P is non-nil, use a cljs connection instead of clj." (org-require-package 'cider "Cider") - (let ((connection (cider-current-connection (cdr (assq :target params)))) - (result-params (cdr (assq :result-params params))) - result0) + (let ((connection (cider-current-connection (if cljs-p "cljs" "clj")))) (unless connection (sesman-start-session 'CIDER)) (if (not connection) ;; Display in the result instead of using `user-error' - (setq result0 "Please reevaluate when nREPL is connected") - (ob-clojure-with-temp-expanded expanded params - (let ((response (nrepl-sync-request:eval exp connection))) - (push (or (nrepl-dict-get response "root-ex") - (nrepl-dict-get response "ex") - (nrepl-dict-get - response (if (or (member "output" result-params) - (member "pp" result-params)) - "out" - "value"))) - result0))) - (ob-clojure-string-or-list - ;; Filter out s-expressions that return nil (string "nil" - ;; from nrepl eval) or comment forms (actual nil from nrepl) - (reverse (delete "" (mapcar (lambda (r) - (replace-regexp-in-string "nil" "" (or r ""))) - result0))))))) + "Please reevaluate when nREPL is connected" + (let ((response (nrepl-sync-request:eval expanded connection))) + (or (nrepl-dict-get response "root-ex") + (nrepl-dict-get response "ex") + (nrepl-dict-get response "out")))))) (defun ob-clojure-eval-with-slime (expanded params) "Evaluate EXPANDED code block with PARAMS using slime." @@ -262,39 +289,52 @@ defun ob-clojure-eval-with-slime ,(buffer-substring-no-properties (point-min) (point-max))) (cdr (assq :package params))))) -(defun ob-clojure-eval-with-babashka (bb expanded) - "Evaluate EXPANDED code block using BB (babashka or nbb)." - (let ((script-file (org-babel-temp-file "clojure-bb-script-" ".clj"))) +(defun ob-clojure-eval-with-cmd (cmd expanded) + "Evaluate EXPANDED code block using CMD (babashka, clojure or nbb)." + (let ((script-file (org-babel-temp-file "clojure-cmd-script-" ".clj"))) (with-temp-file script-file (insert expanded)) (org-babel-eval - (format "%s %s" bb (org-babel-process-file-name script-file)) + (format "%s %s" cmd (org-babel-process-file-name script-file)) ""))) -(defun org-babel-execute:clojure (body params) - "Execute the BODY block of Clojure code with PARAMS using Babel." +(define-obsolete-function-alias 'ob-clojure-eval-with-babashka + #'ob-clojure-eval-with-cmd "9.7") + +(defun org-babel-execute:clojure (body params &optional cljs-p) + "Execute the BODY block of Clojure code with PARAMS using Babel. +When CLJS-P is non-nil, execute with a ClojureScript backend +instead of Clojure." (let* ((backend-override (cdr (assq :backend params))) (org-babel-clojure-backend (cond (backend-override (intern backend-override)) - (org-babel-clojure-backend org-babel-clojure-backend) - (t (user-error "You need to customize `org-babel-clojure-backend' -or set the `:backend' header argument"))))) - (let* ((expanded (org-babel-expand-body:clojure body params)) + (org-babel-clojure-backend (if cljs-p + org-babel-clojurescript-backend + org-babel-clojure-backend)) + (t (user-error "You need to customize `%S' +or set the `:backend' header argument" + (if cljs-p + org-babel-clojurescript-backend + org-babel-clojure-backend)))))) + (let* ((expanded (org-babel-expand-body:clojure body params cljs-p)) (result-params (cdr (assq :result-params params))) result) (setq result (cond ((eq org-babel-clojure-backend 'inf-clojure) (ob-clojure-eval-with-inf-clojure expanded params)) + ((eq org-babel-clojure-backend 'clojure-cli) + (ob-clojure-eval-with-cmd ob-clojure-cli-command expanded)) ((eq org-babel-clojure-backend 'babashka) - (ob-clojure-eval-with-babashka ob-clojure-babashka-command expanded)) + (ob-clojure-eval-with-cmd ob-clojure-babashka-command expanded)) ((eq org-babel-clojure-backend 'nbb) - (ob-clojure-eval-with-babashka ob-clojure-nbb-command expanded)) + (ob-clojure-eval-with-cmd ob-clojure-nbb-command expanded)) ((eq org-babel-clojure-backend 'cider) - (ob-clojure-eval-with-cider expanded params)) + (ob-clojure-eval-with-cider expanded params cljs-p)) ((eq org-babel-clojure-backend 'slime) - (ob-clojure-eval-with-slime expanded params)))) + (ob-clojure-eval-with-slime expanded params)) + (t (user-error "Invalid backend")))) (org-babel-result-cond result-params result (condition-case nil (org-babel-script-escape result) @@ -302,7 +342,7 @@ defun org-babel-execute:clojure (defun org-babel-execute:clojurescript (body params) "Evaluate BODY with PARAMS as ClojureScript code." - (org-babel-execute:clojure body (cons '(:target . "cljs") params))) + (org-babel-execute:clojure body params t)) (provide 'ob-clojure) -- 2.39.2 --=-=-=--