From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id iCJlDul7WmOjRQEAbAwnHQ (envelope-from ) for ; Thu, 27 Oct 2022 14:39:05 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id CI4lDel7WmOsfwAAG6o9tA (envelope-from ) for ; Thu, 27 Oct 2022 14:39:05 +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 C6FAA32C48 for ; Thu, 27 Oct 2022 14:39:04 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oo28j-0008Of-Qf; Thu, 27 Oct 2022 08:37:41 -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 1oo28h-0007kh-41 for emacs-orgmode@gnu.org; Thu, 27 Oct 2022 08:37:39 -0400 Received: from mout-p-101.mailbox.org ([2001:67c:2050:0:465::101]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1oo28e-0007co-LA for emacs-orgmode@gnu.org; Thu, 27 Oct 2022 08:37:38 -0400 Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (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-101.mailbox.org (Postfix) with ESMTPS id 4MylYq2xTtz9spD; Thu, 27 Oct 2022 14:37:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kraus.my; s=MBO0001; t=1666874239; 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=btxwZvyKaJ86Wf8dIOtbuL79n4etGEiQAjg4yTedaxI=; b=AMXinYkDzMsS1VVFjz0fXaglIUU6dtb1g1+5sGUXSQJi4t9lofYwuE1Vnw5hNoCCSYUrKU YR+UacKqbf7eUgXsxkkwYm+wpPxsVmTeDS1J2ZCVWR1ScU8m3hgy82uDuwqSDDy7FbOp0k NpPY4yuyBJWyI143gjKR1JjxfN+1msxY3ITKhkyVtctopGWqpCp4cza+Bown9xW0zXVz0M Dpcg7NdQwUpTG4xs7sLFKQsVW4KNRBk/lxB8ak5oKZTJnGYQCGpv2KM1TBfTl9A10TbZ7A WRot3aOCZqyD84yfvoInn88x+eFqgjN8rVEo+DW25OAJYz2xWLe/LAgd1KgCVQ== References: <87lep3oxcu.fsf@localhost> From: Daniel Kraus To: Ihor Radchenko Cc: numbchild@gmail.com, Org Mode Subject: Re: ob-clojure eval error when has comment at end of code line Date: Thu, 27 Oct 2022 14:25:33 +0200 In-reply-to: <87lep3oxcu.fsf@localhost> Message-ID: <878rl1a1e0.fsf@kraus.my> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: none client-ip=2001:67c:2050:0:465::101; envelope-from=daniel@kraus.my; helo=mout-p-101.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: , 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=1666874345; 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=btxwZvyKaJ86Wf8dIOtbuL79n4etGEiQAjg4yTedaxI=; b=CTiqZ0uLTwjWxMcD8I9N/Km7thiH4xoE8LXdmzLm7BLZn3G8YpW6H10HZMz6kTNNhWd3pw FHaeJopGgyROGnGOIBg1ANUh5OKyY3/a8Dygso3ZRZp/ag0/Io6STiAnxlCcGNezQzn3y8 A8tLYlAFyqoYNKHhDPcbEcJ24hoebaob8jmmkkDS0tdRpCR/mW57YpTkyOGH5W1z5dquAL PlsXtqDUL89Kwffp2+ICP2moGnp42tQCE5NSL/hIsxWtMIt/GdVXRK1JKnugyubZKhhncS zRp3sNDgtth3AuHYwoBdPxo2ET/92D9xOQxI+/VGQvTHo5OuT1wbcbCDBjK0bw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1666874345; a=rsa-sha256; cv=none; b=SyyhTr4wZR3CTEhqjgxx/mXKxjcSrxjkFyXO5LVYLnuxe6PiIu1eKKq+MzG+JcF5sXegBf 1iYfS16VMP9cCfPTQ0Omxcwo0BKd1Hggn+o84AJvIzdpKsmnLrgpo5g3dx5JcJ2MI9gW4w QtdxJ0j6sJ+X46Fl8CQ7KTZRxdbaymU1bCVOlVAhgvGZzR6W/svZNk76wQviHsHlW+U0JV WdACZFSpRxcXn9/tRYfXFLnpkM4zHMCiR7TivHW1Grfykcyv1QPFoRC4L6A0ZGDWHK8Fhk vGsOsTm4wyfmeD1xSjGJ+AIbhbXnKEHKwwvi1jpx7rF+wIVDKdltxYhmwAnD0w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=kraus.my header.s=MBO0001 header.b=AMXinYkD; dmarc=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: -2.02 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=kraus.my header.s=MBO0001 header.b=AMXinYkD; dmarc=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: C6FAA32C48 X-Spam-Score: -2.02 X-Migadu-Scanner: scn1.migadu.com X-TUID: AoRZVbA2q0pc --=-=-= Content-Type: text/plain Hi! I had a look and apparently cider-eval returns nil when the expression is a comment, vs the string "nil" when the Clojure expression returns nil. Simply filtering nil values out seems to have fixed the issue for me. @Christopher, can you check the attached patch if this works for you? @Ihor, a few developer related questions: - I wanted to add a test, how can I run only test-ob-clojure? I don't think the tests work currently and I would fix them and add more. - What should I use for indention? Looking in ob-clojure and org.el it seems that using tabs with tab-width 8 is standard but there's quite a few lines where it's spaces only. - If this simple patch for example or fixing tests is good, should I just install it? Can I "freely" install minor changes to ob-clojure or should everything go over the mailinglist? Thanks. I hope I can work a bit more on ob-clojure the next few days, I think I missed a few emails, sorry. Now I have a filter rule where mails with Clojure in the subject go to my inbox. Cheers, Daniel --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-lisp-ob-clojure.el-Fix-bug-with-inline-comments.patch >From 87054023df0876d17771ee3885e7b1091ccdeab1 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Thu, 27 Oct 2022 14:16:33 +0200 Subject: [PATCH] lisp/ob-clojure.el: Fix bug with inline comments * lisp/ob-clojure.el (ob-clojure-eval-with-cider): Filter out nil values from cider evaluation. --- lisp/ob-clojure.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el index 0649469b3..eff8d04e4 100644 --- a/lisp/ob-clojure.el +++ b/lisp/ob-clojure.el @@ -239,7 +239,7 @@ or set the `:backend' header argument")))) result0))) (ob-clojure-string-or-list (reverse (delete "" (mapcar (lambda (r) - (replace-regexp-in-string "nil" "" r)) + (replace-regexp-in-string "nil" "" (or r ""))) result0))))))) (defun ob-clojure-eval-with-slime (expanded params) -- 2.38.1 --=-=-= Content-Type: text/plain Ihor Radchenko writes: > "Christopher M. Miles" writes: > >> I have following Clojure source block: >> >> #+begin_src clojure >> (re-find #"\d+" "I've just finished reading Fahrenheit 451");; => "451" >> (re-find #"Bees" "Beads aren't cheap.");; => nil >> #+end_src >> >> When I press =[C-c C-c]= to evaluate source block, got error: >> >> When there is no comments behind code lines. No this error. >> >> #+begin_example >> Debugger entered--Lisp error: (wrong-type-argument arrayp nil) >> replace-regexp-in-string("nil" "" nil) > > Daniel, could you please take a look? --=-=-=--