From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id AKQ3FR7f1mDWDAEAgWs5BA (envelope-from ) for ; Sat, 26 Jun 2021 10:02:38 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id gFjpEB7f1mBZGgAAbx9fmQ (envelope-from ) for ; Sat, 26 Jun 2021 08:02:38 +0000 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 7A7EFA514 for ; Sat, 26 Jun 2021 10:02:36 +0200 (CEST) Received: from localhost ([::1]:48254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lx3Gt-0006GZ-6S for larch@yhetil.org; Sat, 26 Jun 2021 04:02:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lx3GW-0006GR-6K for emacs-orgmode@gnu.org; Sat, 26 Jun 2021 04:02:12 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:37816) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lx3GU-0008K1-8r for emacs-orgmode@gnu.org; Sat, 26 Jun 2021 04:02:11 -0400 Received: by mail-pl1-x62c.google.com with SMTP id o3so838798plg.4 for ; Sat, 26 Jun 2021 01:02:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:subject:date:in-reply-to:message-id :mime-version; bh=tMHXCYf353z8yIBOogQ2LlNMs7111d5Vs/rMYUE10+Q=; b=NOySCCTiC7kEblEJHEo9La+SKH5vB9HnP0/ggnkrubBG/kblGizaPh4WqckIfG0xMh CrUgum8CyMYN5hq0d117mnPCk6Mu60I2pd1uMIHW6RQ3madDPAsS8+wHP/H7M8+Kaa5f I/KvLOcR3sUIAoEDQ2y/FpIFZBaOiqBoJLAs9F7YK/zu69lqRD5fxCptjTRUMCTEjKjt gNLfKi/pMauVmehhy7oel7gGl5AdQvPuUfbK6El0ADAJYWNDclpGJ0h2cHFv3jBICGvA o5wo2u8Hl++MMaSvNZKeVRbWUpknNYrtUdnbUzbaVHJAVE9oZDkR2NdWGqvmSNc5Dejf G9Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:subject:date :in-reply-to:message-id:mime-version; bh=tMHXCYf353z8yIBOogQ2LlNMs7111d5Vs/rMYUE10+Q=; b=iYa+n1NI8TIb96Y4Kz5wNxXoWPNLc6TtqQG3ssGcpHx3byeRJxB4dk0F++flGaBYoX tYrV+KXWtmX6O0fdgC/ytsfgnpntqkj3CFqMpJDtX51JtTz6TWpMVEkfCYfGXLHXMrv/ OJwQ2kpF4CctO07HcxrVnw67zIEZj9Vwm58sm+Hk1NXnnNJRn2693Ng59U8VXsdw83t9 7Gwf8WJgA0SrFixh5NxQzTXZtZibTLqqw1e/PfvdvcFVIMRs8IH+xSJ5Gqr3BF0RG0au gLN/uxcnMSYIV4lBxdSHDX33IEaiwrz9CiMWJZ84CoN7T7Rurxnig5G09fwwake1v8FA itXQ== X-Gm-Message-State: AOAM53369sOIjCX/NKEgpiiEUXghJSBkyuy8D2rFKY7EF0XyxCTgjsjj /OmmOYPAmk5fTbeF2fYOISoqx4CKjAw= X-Google-Smtp-Source: ABdhPJwmNQNZIBlr1Lbg3TGEdzj51Umi0Qv3qII5vw6ORfAdgeMuOEaKN9NP/qICWBb2WfOsp/WJwg== X-Received: by 2002:a17:902:b618:b029:122:9762:d8c3 with SMTP id b24-20020a170902b618b02901229762d8c3mr12592056pls.4.1624694527998; Sat, 26 Jun 2021 01:02:07 -0700 (PDT) Received: from tim-desktop (220-235-1-254.dyn.iinet.net.au. [220.235.1.254]) by smtp.gmail.com with ESMTPSA id n34sm1127350pji.45.2021.06.26.01.02.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Jun 2021 01:02:07 -0700 (PDT) References: <892BF03F-7EA8-4DC7-BC63-90E24D98F5EF@nordakademie.de> <5C74CBCB-3AFF-4AF3-A4AC-69BF05192972@nordakademie.de> User-agent: mu4e 1.5.13; emacs 28.0.50 From: Tim Cross To: emacs-orgmode@gnu.org Subject: Re: appearance of list as results from evaluating code blocks Date: Sat, 26 Jun 2021 17:48:00 +1000 In-reply-to: Message-ID: <87h7hl2gw3.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=theophilusx@gmail.com; helo=mail-pl1-x62c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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.23 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" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1624694557; h=from:from:sender:sender: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:dkim-signature; bh=tMHXCYf353z8yIBOogQ2LlNMs7111d5Vs/rMYUE10+Q=; b=T6ZayS3NJ6LI9vqFguc/ja3Clfwh63qvZt9dXYTw7inF5x2W7E/69bVs0x46wvYQnQhXzp Abelc5P3iONJpv5sE6Nc77YJ0QQvBwXipXqpYFd3bbo9K8PfIzcEIIc7jrso2Hf9tgd9LY ocKUiCxAB+B7r9/lfcDJNBPH4vaWZOoC9iCsVLB/3VHY53AHxM6M58H3eM9QpbaW4VRc9X VGXS82T9DSA1ERevcv4lKE1WdlKDGymmvY85FpF1r+oeJp31dfIZmVGWmo7pRjbPcug6s5 8You/YclVNM1BNaM2AeG4ffd0et3+/xCitIyJwDk4871aA4M6pu4eFlddVToNQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624694557; a=rsa-sha256; cv=none; b=tUtdhu8rNMD6dOZftHQmXEHx/MzLWph8LbmQWp9WrrUNI4W/2PeXxPNqjdgpswQtrNajwZ 4c4lsc8bnqtgicVxTZZeTKnWVMaEHu93P7DSLfqPAM0MKZKh7KukHvMpyj8Z8vIkCZDotC YMGWwM5467Ohta42dbEdU5J/n02/yi84l3KBbAR+hHb1HHntTv4NsDoBleDETKQcXE48t1 O9FXwp6zvWlFI3vqNYsc0ib4w2UwgZGX6iiNipxRuDpsTo6rtClG51RkZG+FpGbuyEhhJf MIIcyUDlhS4d3YV4I2e1/7ycRcTDsf38w+uqKCo1f0icub7y0loTrC9qnit5FA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=NOySCCTi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.13 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=NOySCCTi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 7A7EFA514 X-Spam-Score: -3.13 X-Migadu-Scanner: scn0.migadu.com X-TUID: Rv53bC1MWaat John Kitchin writes: > I think something is fishy in ob-clojure. > > When I look at how it runs, it is not obvious it is returning anything. Instead it is wrapping the body like this > > "(clojure.pprint/pprint (do (list 1 2 (+ 1 2))))" > > which I assume is going to stdout maybe? > > With Cider I eventually got to this intermediate result, which looks like maybe there is a terminating nil getting read from the repl that is eventually > chomped to "". > > Result: (dict "status" ("done" "state") "id" "12" "out" "(1 2 3)\nnil\n" "session" "c72a3a11-8982-4ead-a0bf-cb92a24a966c" "ns" "user" "value" "nil" > "changed-namespaces" (dict) "repl-type" "clj") > Yes, I think your probably correct. If the form is wrapped in (clojure.pprint/pprint ....), then the 'code' result from evaluation would indeed be nil as the return value for pprint is nil. The ob-clojure module is IMO a little 'odd' because it uses cider, so there is another layer of indirection you don't see with other ob-* which just run the code inside a language shell. I also find this distinction between 'code' and 'value' a bit confusing at times. I can see why something is needed (for example, when running shell scripts and sometimes you want the 'output' and sometimes you want the exit code etc. However, the distinction is less clear in some languages, like clojure, where there is no real distinction i.e. how does code differ from value as a result? What does 'code' really mean in this context?. I think the ob-clojure library probably needs a bit of work. Since it was originally written, clojure has moved on a bit and it would probably make sense to look at possibly basing it on clj-tools rather than cider. When I was trying to use it, I constantly ran into problems because cider was evolving too rapidly and things kept breaking. I actually had better success using the 'inf-clojure' interface, but that had issues too (for example, with the :session switch). Someone did send in a patch some months back which had a first go at implementing support for clj-tools. I was too busy to review it at the time., I later went to have a look at it and a message was sent to the patch author for a copy of the most recent version of the patch, but there was no response. -- Tim Cross