From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.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 0H0xOs8jC2Q8YgAASxT56A (envelope-from ) for ; Fri, 10 Mar 2023 13:34:24 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id CIRsOc8jC2SOxAAAG6o9tA (envelope-from ) for ; Fri, 10 Mar 2023 13:34:23 +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 B21F6F6DE for ; Fri, 10 Mar 2023 13:34:23 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=cnuNVif4; dmarc=pass (policy=none) header.from=posteo.net; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1678451663; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=tALNDgGJSvThD+kVJUW2wjCJUx9I0rXEpr9vNNQgeJ0=; b=jn9zOiJvJRDb91na8cNn/8pl8dqsDgLeVPKbruOBbuu2XGjWKsyn0+CcB5O0UzSOgvj8Dr rBmeyA3SsIMi7FdyX0YfTw1NUPR9iflkg8d2GcDCBo3zEQ+7i4sV3nF+SFdNcsIsYmAQMF CliYw1gytR1sy4hfkR2wnl/D9IdEgiu6oT5OPi+AsjnqzEszt+BZswtfk15aBxmx3+T88X rIL3+n5S4T1NGscVHhNAVpQ2O6kuzpLF3JS2LDDGWMQCFYPA08nYjk8kT7QHSwdDA6B4mN fzi+Ptl1GmQkOEFUs4mVOwnX83bfm1ZXqRoWLAk04AKu5LdDC+5s3N9NMGjV6Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=cnuNVif4; dmarc=pass (policy=none) header.from=posteo.net; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1678451663; a=rsa-sha256; cv=none; b=jL8U0SWMvMYKEFrF+WgFG66Ni2hGLxhIyyO8+C2HfE/vi8a8BUlahW8AgmnvazpbqBbsBg sqpskLYAa3wLoiS48UvJfXrEPpO1p+vHp8d74OZjwyJliczege5qqsM/PDSuTaqbnixrBQ QGqpWRwvomIEd98sf7lglji77HcMZDferCaH6UwmfYRbInZyHz7EACOUx2bt2kJ4xrBkuq yV7KJVsraMWFBC+3JAaVtDC7WisjKXc2dvbWZOUV2dtXkcqaXNiUBXxhQwb24idq5AT18Z ZUhdrpaKy58l+ACIWLBv0w2wUgm9AR5GbBB1d0DpWX5usFeAigtW4t2I/6CBYw== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pabwl-0004Eb-PU; Fri, 10 Mar 2023 07:34:08 -0500 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 1pabwj-0004CM-PR for emacs-orgmode@gnu.org; Fri, 10 Mar 2023 07:34:05 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pabwT-0001DZ-Ib for emacs-orgmode@gnu.org; Fri, 10 Mar 2023 07:33:51 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 97F142401D4 for ; Fri, 10 Mar 2023 13:33:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1678451627; bh=oVoIJDyUJVwtHFGnH0zFEUC+K8bKc5B0LsYGUUeuG3o=; h=From:To:Cc:Subject:Date:From; b=cnuNVif4gE7WQhUUTDjI7RhoR3l3prsud4YtuO/+vjgfY1YO/teZfrMcQ9B6BWmds 5/f5hfxDQgfrqySgzBM/BTZwRJgxQ/N5Ar/bERj/JO9qDnF4CKgvhlUxnYiyTZ2Mod HzP6fkIKbcry9n4E/c8CgNhUrwnACLmMjGuzu+LNgAQPPbMqpGpchwRTVLic3hp/jh 2Pp8OAdO5XNrcZqSaTWD/dm5fMZWgxsAGGs/JrG//5QXCjBMmliX2Rshlvci/bv/R4 vdVK1cQ51mgywcoPsaEKSuNrfsXJXEFPlZeJxdmVfe/Dq+YK4xgap7xyu5UqeALbaH R1BCL3kli3J4w== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PY57r1w2Gz6tmd; Fri, 10 Mar 2023 13:33:44 +0100 (CET) From: Ihor Radchenko To: Daniel Kraus Cc: emacs-orgmode@gnu.org Subject: Re: [patch] ob-clojure: Fix results output In-Reply-To: <87mt4m53qj.fsf@kraus.my> References: <87mt4m53qj.fsf@kraus.my> Date: Fri, 10 Mar 2023 12:35:10 +0000 Message-ID: <87pm9gyebl.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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: X-Migadu-Queue-Id: B21F6F6DE X-Spam-Score: -11.19 X-Migadu-Spam-Score: -11.19 X-Migadu-Scanner: scn0.migadu.com 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 X-TUID: PhGajHkiC9kO Daniel Kraus writes: > attached is a bigger patch that fixes the result output of ob-clojure. > The commit message contains examples what's currently wrong > and what's fixed. > This is a breaking change though. > So if someone before relied on the fact that, e.g. cider, returns > the result of every expression in every line instead of only the > last one, they get a different result now. The current behaviour is a bug anyway: =E2=80=98value=E2=80=99 ... =20=20=20=20=20 When evaluating the code block in a session (see *note Environment of a Code Block::), Org passes the code to an interpreter running as an interactive Emacs inferior process. Org gets the value from the source code interpreter=E2=80=99s last statement output. Org has = to use language-specific methods to obtain the value. For example, from the variable =E2=80=98_=E2=80=99 in Ruby, and the value of =E2=80= =98.Last.value=E2=80=99 in R. > Is it ok to install? > Other feedback? You need to document the changes 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. > -;; Support for evaluating Clojure code > +;; Support for evaluating Clojure / ClojureScript code. This is an important new feature that should be announced clearly in ORG-NE= WS. Also, make sure that https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html is up-to-date. > (defcustom org-babel-clojure-backend (cond > ((executable-find "bb") 'babashka) > - ((executable-find "nbb") 'nbb) > + ((executable-find "clojure") 'cloj= ure-cli) > ((featurep 'cider) 'cider) > ((featurep 'inf-clojure) 'inf-cloj= ure) > ((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. > +(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. > -(defcustom ob-clojure-nbb-command (executable-find "nbb") > +(defcustom ob-clojure-nbb-command (or (executable-find "nbb") > + (when-let (npx (executable-find "n= px")) > + (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. > +(defcustom ob-clojure-cli-command (when-let (cmd (executable-find "cloju= re")) > + (concat cmd " -M")) > + "Clojure CLI command used to execute source blocks." > + :type 'file > :group 'org-babel > :package-version '(Org . "9.6")) 9.7 > (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=3D (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 > -(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? --=20 Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at