From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Cross Subject: Re: [PATCH] Re: ob-clojure.el: Add ClojureScript interface Date: Sat, 15 Feb 2020 11:42:25 +1100 Message-ID: <875zg8el5a.fsf@gmail.com> References: <20180422205003.87836-1-roberthambrock@gmail.com> <20180422205003.87836-3-roberthambrock@gmail.com> <87v9ocuesg.fsf@gmail.com> <87imkb7mwj.fsf@gnu.org> <87y2t6fqwj.fsf@gmail.com> <87pnei8oe0.fsf@bzg.fr> <87k14prbb5.fsf@gmail.com> <87eeuxqyeq.fsf@bzg.fr> <87eeuxqjxq.fsf@gmail.com> <87v9o8zyzs.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:56208) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2lXc-0003fm-49 for emacs-orgmode@gnu.org; Fri, 14 Feb 2020 19:42:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j2lXa-00076y-TW for emacs-orgmode@gnu.org; Fri, 14 Feb 2020 19:42:39 -0500 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:41271) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j2lXa-00074w-Le for emacs-orgmode@gnu.org; Fri, 14 Feb 2020 19:42:38 -0500 Received: by mail-pf1-x442.google.com with SMTP id j9so5656474pfa.8 for ; Fri, 14 Feb 2020 16:42:38 -0800 (PST) Received: from tim-desktop (203-173-21-83.dyn.iinet.net.au. [203.173.21.83]) by smtp.gmail.com with ESMTPSA id s14sm8092048pgv.74.2020.02.14.16.42.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2020 16:42:35 -0800 (PST) In-reply-to: <87v9o8zyzs.fsf@gnu.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org I wonder if it would make sense to use shadow-cljs rather than cider as a back end for evaluating clojurescript? More generally, I wonder if there would be any benefit in considering a Clojure CLI Tools back end integration and bypassing CIDER altogether? While I love CIDER, I'm not sure it is the right tool for a org-babel type environment. I've recently been moving my projects from being lein based to Clojure CLI tools based and while I still use CIDER for larger development work, find the CLI great for basic execution of code. For me, CIDER has a lot of additional overhead and complexity which is often of little benefit to what I want via babel and I've found it to be a very fragile environment. Sean Corfield has a great example deps.edn file at https://github.com/seancorfield/doc-clojure and it shows how you can hook in various different REPLs - for example, a basic socket based REPL, which might provide a cleaner and more stable back end interface for evaluating Clojure (and potentially clojurescript) for babel. My rough and immature idea would be to have a back end that allowed you to specify CLI aliases in the block header. These aliases can do a lot, including select whatever execution environment you want the code to run in. The back end could have default aliases for basic evaluation and it could all be based around a socket REPL, which should make sending/reading from the REPL fairly straight-forward. As I said, this is an initial and immature idea, but I think it could provide a back end which was a little more like other babel back ends and may be less fragile than one based on CIDER (plus I suspect it would be faster). What do people think? Is this something worth investigating further? Bastien writes: > stardiviner writes: > >> I use CIDER (sesman) keybinding =[C-c C-s d]= on ob-clojure src >> block to link current buffer directory to CIDER REPL session. > > I simply start Cider with C-c M-j and then execute the Clojure source > block with C-c C-c, it works fine. > >> I guess this should work for ClojureScript src block too. > > IMHO it works differently for ClojureScript, as C-c M-J doesn't know > how to start a ClojureScript session unless you're in a directory with > the proper cljs configuration (be it figwheel-main.edn, dev.cljs.edn, > whatever.) At least this is how I made it work. -- Tim Cross