From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id CIUEMtcLUmJPOAEAgWs5BA (envelope-from ) for ; Sun, 10 Apr 2022 00:42:31 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 4EttL9cLUmKaIgEA9RJhRA (envelope-from ) for ; Sun, 10 Apr 2022 00:42:31 +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 42DE21BA70 for ; Sun, 10 Apr 2022 00:42:31 +0200 (CEST) Received: from localhost ([::1]:40846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ndJmo-0005O0-6F for larch@yhetil.org; Sat, 09 Apr 2022 18:42:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ndJmK-0005M5-NI for emacs-orgmode@gnu.org; Sat, 09 Apr 2022 18:42:00 -0400 Received: from [2409:8a28:6031:60:52d2:f5ff:fe16:c591] (port=50980 helo=Mac-mini.local) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ndJmI-0004V9-4m for emacs-orgmode@gnu.org; Sat, 09 Apr 2022 18:42:00 -0400 Received: by Mac-mini.local (Postfix, from userid 501) id 05A8C45A42ED; Sat, 9 Apr 2022 21:23:18 +0800 (CST) User-agent: mu4e 1.6.10; emacs 29.0.50 From: "Christopher M. Miles" To: Org Mode (org-mode) Subject: [PATCH] Fix ob-clojure handling source block variable's value is a org-mode table or list Date: Sat, 09 Apr 2022 21:19:54 +0800 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 2409:8a28:6031:60:52d2:f5ff:fe16:c591 (deferred) Received-SPF: softfail client-ip=2409:8a28:6031:60:52d2:f5ff:fe16:c591; envelope-from=numbchild@gmail.com; helo=Mac-mini.local X-Spam_score_int: 48 X-Spam_score: 4.8 X-Spam_bar: ++++ X-Spam_report: (4.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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665, SPOOFED_FREEMAIL=1.522, SPOOFED_FREEMAIL_NO_RDNS=0.001, SPOOF_GMAIL_MID=0.799, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Reply-To: numbchild@gmail.com Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1649544151; 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:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=vHZg8JrHaI1LK5h2sO/KB3+0+Yb43RuuIQBM/kfdfYQ=; b=GUy3Y2HNsxUEseqAQH3/paH2On1noTY/ODoZZrZC+g2u3D5FrKNEqgoj1ZzaL64laHADW2 gFnSoLTKYdV4aH7D7+XobtubHUeBuowlT3u3KMW3HG/E0IM2nMfoihOU7JE4LtKuKD/q1f aLkkVp65EOAoWnRR5vyWqLZce9vJs6hxSHBkwWhrezUDlK8Gwt4b/GxYl9tzppbeCJEAIh d9jwW0/VcHFRDb8k5FiPqFZIyp8rvsMwR7Vlj+DegBVcMMlpvxyc4Rcgq1oi14RJnMDb/T c6//hpZ9yqy+iM+1ebovYq/OM6lF3boXzqkD1rODFMP88sCSihb8F55KTIkX7g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1649544151; a=rsa-sha256; cv=none; b=MvHKhKN1ubAb54nNKH1RXaoX0tLJhbPJSAMkqDm69L+yGI0nFirJXbBeuf9nIHIOYGYIms Qk1lFienJ3mrTH6Lj0GxYL9ZabTrR/0BWJcSGNtfdbVEdFMBdS68jb5PoMUpcZYvscnAR7 TI5fL7IU9r16pMhB1nB91EU/uOHVmVSebRw0fx/00BDGPrYqOzVJofLIgzbDfWBa6OoaT4 DQXFZixpY1aHBq7C2v9YNFA4/RQOly6zScWjCCFGlaabMP9TCVZExDM+MGHc0x6J6jGwLG Y9GoB8NNIHEJIypRsbEBh9OsLu1Jy0X7S4zMWpT7xTQr8OMk3CFEDTC4rX/b5A== 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: 0.53 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: 42DE21BA70 X-Spam-Score: 0.53 X-Migadu-Scanner: scn0.migadu.com X-TUID: btMAsIfSkmnl --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain 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=ob-clojure-table-test :var kk2=ob-clojure-table-test-2 :results output (println kk2) (println kk) ,#+end_src #+end_src Without this patch, it will report error "class java.lang.ClassCastException" from CIDER. This patch added if condition to handle this table, list type data. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-ob-clojure.el-Fix-header-argument-var-binding-passed.patch Content-Transfer-Encoding: quoted-printable From=20948e8c1ff2c9ba1d9c0fe26f9bdaa096bef80a9d 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 tab= le 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. =2D-- 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 =2D-- 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) =2D (format "(let [%s]\n%s)" =2D (mapconcat =2D (lambda (var) =2D (format "%S %S" (car var) (cdr var))) =2D vars =2D "\n ") =2D body)))))) + ;; variable's value is a list from org-mode passed tabl= e 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 not = 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) =2D-=20 2.35.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-ob-clojure.el-Fix-header-argument-var-binding-passed.patch Content-Transfer-Encoding: quoted-printable From=20948e8c1ff2c9ba1d9c0fe26f9bdaa096bef80a9d 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 tab= le 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. =2D-- 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 =2D-- 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) =2D (format "(let [%s]\n%s)" =2D (mapconcat =2D (lambda (var) =2D (format "%S %S" (car var) (cdr var))) =2D vars =2D "\n ") =2D body)))))) + ;; variable's value is a list from org-mode passed tabl= e 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 not = 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) =2D-=20 2.35.1 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable =2D-=20 [ stardiviner ] I try to make every word tell the meaning that I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAmJRiMIACgkQG13xyVro msMniAf/V1DUSaX3aZH0p98g8gTjyOXH5/kscVJNKzcxAtj3IW3hQ2kyoIRY5Rxt ZV93Dm+SGqB8sBFzbiK0BYzoy8DDXDSkiyh/cHIvkAOBzr1T7GldPyfalPaPLbKG UwyVuH3WuYR1CLAR1ffMKOI1ykeuQfnjOhSvypIezqi646hVJ5e+OWKohyRYMMO4 Mo6VSinkyHed0k7kPr8RDk26LLsdP0oFLx+NLf5jJPKTFzDgYiXAGsLkdb9D78Oq ATa043f0f4rZw7vzHToSFBsS2oys3QybY4elXCcgvHtEJCw/qW1Po9Y6nHwFyZRx 8GJX8SYX/H5NKZxq/udpaO7hhPjKrw== =+M6Y -----END PGP SIGNATURE----- --==-=-=--