From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id CPoqHuy7XGN4JwAAbAwnHQ (envelope-from ) for ; Sat, 29 Oct 2022 07:36:44 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id AFAPHuy7XGPkIgEAauVa8A (envelope-from ) for ; Sat, 29 Oct 2022 07:36:44 +0200 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 30A3B21CE3 for ; Sat, 29 Oct 2022 07:36:44 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooeUC-0002gq-Ba; Sat, 29 Oct 2022 01:34:24 -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 1oodKJ-0008MG-2b for emacs-orgmode@gnu.org; Sat, 29 Oct 2022 00:20:07 -0400 Received: from [39.171.215.96] (helo=Mac-mini.local) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oodKG-00074x-5N for emacs-orgmode@gnu.org; Sat, 29 Oct 2022 00:20:06 -0400 Received: by Mac-mini.local (Postfix, from userid 501) id 4CC686AAD574; Sat, 29 Oct 2022 12:19:52 +0800 (CST) References: User-agent: mu4e 1.8.10; emacs 29.0.50 From: "Christopher M. Miles" To: Org Mode Subject: Re: [PATCH] Fix ob-clojure handling source block variable's value is a org-mode table or list Date: Sat, 29 Oct 2022 12:19:39 +0800 In-reply-to: Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Host-Lookup-Failed: Reverse DNS lookup failed for 39.171.215.96 (deferred) Received-SPF: softfail client-ip=39.171.215.96; envelope-from=numbchild@gmail.com; helo=Mac-mini.local X-Spam_score_int: 58 X-Spam_score: 5.8 X-Spam_bar: +++++ X-Spam_report: (5.8 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FROM=0.001, MSGID_MULTIPLE_AT=1, NML_ADSP_CUSTOM_MED=0.9, RCVD_IN_PBL=3.335, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665, SPOOFED_FREEMAIL_NO_RDNS=0.001 autolearn=no autolearn_force=no X-Spam_action: reject 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: , Reply-To: numbchild@gmail.com Sender: "Emacs-orgmode" Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1667021804; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to: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; bh=amJu29pc9eDeM34MwVS7qQ+Bd1xiJsnvDlELjwmWZXM=; b=qqlhSKKxz8S/uMWYF5ug77y9TjeeTDW6E8sKch6n31hSlq7aNL5JWRpp/VEp3P4icyP0vR PviDfbeZCoze0kaU2nLXdv6Ha9l9PspkXe7nFaZ6nw2a1hoolpzhXXKzxFA6KKblxV8SgG ktsYH6s5NmZ29Tx5JPRXfAyC6QrOAUTODv/WJl7QFfHPPgAGPAkxAtYG7EiGrnHyArDfQe 4oMJmFusBfh+fQ9GsQ7yxxWdgFJMkuwVQIDZMhsw7kPgj8pZQ9dpBtByprMYRkWN5fbLCH sK1CwXzGPDk5CruMKKZlCNO6WWeZt0aj/ux0W/J1bBMqv7jJSbrxtUQMCGxoMQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1667021804; a=rsa-sha256; cv=none; b=iZY6h2+dnT/bAXOm2eddB9x0BRkip16WxcxCq4agG2/eR7TYim2wJ7mbKgJsVGVbk0xw76 7cqdS/ufDid7317lJihNCJHuHTJdWAXrmaQk3Dl+s7YrBvsicU+XO4TFcN78/FgPSuxQ73 ZpQjDFhPbgyAqJYvZN9q9CvoVQIGVMyr6qKi58ZW1EtEv4/0Sil9MdKeXvBPB4+kpLJEt2 +ifW6kb+yYl/C6WMavgE9UNP1YqCM0ELZy27RU8Q91uh2BzLT98eCEpg3GsqxR8oZ1hOnr wSuIlkry4oLlg+RX06dQSKoBz/zRkfklDmO0CtSIjGtHs4kJCzH0zl63CPubqA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); 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" X-Migadu-Spam-Score: 1.67 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); 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" X-Migadu-Queue-Id: 30A3B21CE3 X-Spam-Score: 1.67 X-Migadu-Scanner: scn1.migadu.com X-TUID: IBGSp+jnfkDK --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Any review comments about this patch? "Christopher M. Miles" writes: > [[PGP Signed Part:Undecided]] > > I bellowing example: > > #+begin_src org > ,#+NAME: ob-clojure-table-test > | a | b | c | > |---+---+---| > | 1 | 2 | 3 | > > ,#+NAME: ob-clojure-table-test-2 > | a | b | c | > |---+---+---| > | 1 | 2 | 3 | > > ,#+begin_src clojure :var kk=3Dob-clojure-table-test :var kk2=3Dob-clojur= e-table-test-2 :results output > (println kk2) > (println kk) > ,#+end_src > > #+end_src > > Without this patch, it will report error "class java.lang.ClassCastExcept= ion" from CIDER. > > This patch added if condition to handle this table, list type data. > > From 948e8c1ff2c9ba1d9c0fe26f9bdaa096bef80a9d Mon Sep 17 00:00:00 2001 > From: stardiviner > Date: Sat, 9 Apr 2022 21:14:22 +0800 > Subject: [PATCH] ob-clojure.el: Fix header argument :var binding passed t= able > or list data > > * lisp/ob-clojure.el (org-babel-expand-body:clojure): Add if condition > to handle source block :var passed org-mode table or list data for > clojure let-binding to avoid java.lang.ClassCastException. > --- > lisp/ob-clojure.el | 25 ++++++++++++++++++------- > 1 file changed, 18 insertions(+), 7 deletions(-) > > diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el > index 5a44b6487..e6614b2d9 100644 > --- a/lisp/ob-clojure.el > +++ b/lisp/ob-clojure.el > @@ -101,13 +101,24 @@ > (and (cdr (assq :ns params)) (format "(ns %s)\n" ns)) > ;; Variables binding. > (if (null vars) (org-trim body) > - (format "(let [%s]\n%s)" > - (mapconcat > - (lambda (var) > - (format "%S %S" (car var) (cdr var))) > - vars > - "\n ") > - body)))))) > + ;; variable's value is a list from org-mode passed ta= ble or list. > + (if (listp (cdr (car vars))) > + (format "(let [%s]\n%s)" > + (mapconcat > + (lambda (var) > + (format "%S '%S" (car var) (cadr var))) > + vars > + "\n ") > + body) > + ;; else, the header argument variable's value is no= t a list. > + (format "(let [%s]\n%s)" > + (mapconcat > + (lambda (var) > + (format "%S %S" (car var) (cdr var))) > + vars > + "\n ") > + body) > + )))))) > (if (or (member "code" result-params) > (member "pp" result-params)) > (format "(clojure.pprint/pprint (do %s))" body) > --=20 > 2.35.1 > > [5. text/x-patch; 0001-ob-clojure.el-Fix-header-argument-var-binding-pass= ed.patch]... =2D-=20 [ stardiviner ] I try to make every word tell the meaning that I want to express without mi= sunderstanding. Blog: https://stardiviner.github.io/ IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAmNcqecACgkQG13xyVro msMdSwf+L7Hks5uigmOcEqjc8AY7ra+MTBmNzIRZX526P30w+90K5IG+OA9+4Fc/ HYp/jtxjDBEsiBkOeU426RKwfqi2Ny9lkxX08OyNIRw/1pQD6zL2GTpa+oY9dzvc cKnMytaggBRjUtFuycxHDTh18zmYEoabcXcwlikxOqaUyw5J5TcEN9C1M0p3POlb QKOu39F/9t0qeylBA13q3Ak7gWBlClj58asmkavUyFZLSsilAytAhlmKAFQ/a1od gEkdU9ezXy79eCi3EUD6gGBc9DuVF3F5dTmj7oWMoZV7a7YsQzcLwI2LSTRbDxP8 8gZ/wYM2IL7H+xdQDYKApFcMdWC4qQ== =5oE+ -----END PGP SIGNATURE----- --=-=-=--