Re: [PATCH] Re: ob-clojure.el: Add ClojureScript interface
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Bastien writes: > Hi stardiviner, > > stardiviner writes: > >> I tested your method, true. And I also pulled that latest ob-clojure.el >> changes. >> Works great, I like this new method more. Thanks for your >> improvement. > > Thanks for your feedback. > > Also, you may have noted that the code for Clojure sessions has been > removed - I could not make it work, even in previous versions. Yes, I always check related changes on Org Mode master branch source code. > > If you know sesman/cider better than I do and can propose to handle > sesman/cider sessions correctly, please go ahead. > > By "correctly" I mean requesting the launch of a (sibling?) nREPL > process buffer when :session is set to a string. Actually I'm not very familiar with CIDER, but I want to take a try. :) > >> The clojurescript support has a ~:target~ header argument to tell CIDER this >> is a >> clojurescript code, I don't know CIDER internal much, but CIDER eval should >> eval >> in a ClojureScript corresponding REPL. > > Yes, what I meant was that for now ":target cljs" won't let you start > a nREPL unless you are in a ClojureScript project. > > cider-jack-in-cljs will ask for the cljs method (figwheel-main, etc.) > but if your org file is in, e.g., an empty directory, there is no such > cljs configuration file. I agree. - -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 -BEGIN PGP SIGNATURE- iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl5NWYoUHG51bWJjaGls ZEBnbWFpbC5jb20ACgkQG13xyVromsNpkggAtMIWaYdp6nJrNw820X8BZaL4luW4 hZeBf7YJaomopWZK5ToGquGMVTCsPuvxKtSBwlM00WEaklDfmDN6C50aqDvyVesk E+emQ4rF8a2A0LfvUw4CwoRLaqoa9gJUzGzwWFuz//HY8DHkl2n2jbTaLDLuzlOT laAFODwzGHbJlm/MFayKds+jLMLP95F5D+6G6ZPKitfnfyurAwp9OGnI9G63w9Ye LVD0Yqcr3jLUgHJfSSaUAny8DV9DOlvaVez1AZQosc//PER5DqxXHeMhaLMSNEGB RI7W6ufOfSRT0L4gQ3H9W4X34Kt28+Aoj2wGvx2q4niI9pxEkW1kLzpF2w== =LNjE -END PGP SIGNATURE-
Re: [PATCH] Re: ob-clojure.el: Add ClojureScript interface
Hi stardiviner, stardiviner writes: > I tested your method, true. And I also pulled that latest ob-clojure.el > changes. > Works great, I like this new method more. Thanks for your > improvement. Thanks for your feedback. Also, you may have noted that the code for Clojure sessions has been removed - I could not make it work, even in previous versions. If you know sesman/cider better than I do and can propose to handle sesman/cider sessions correctly, please go ahead. By "correctly" I mean requesting the launch of a (sibling?) nREPL process buffer when :session is set to a string. > The clojurescript support has a ~:target~ header argument to tell CIDER this > is a > clojurescript code, I don't know CIDER internal much, but CIDER eval should > eval > in a ClojureScript corresponding REPL. Yes, what I meant was that for now ":target cljs" won't let you start a nREPL unless you are in a ClojureScript project. cider-jack-in-cljs will ask for the cljs method (figwheel-main, etc.) but if your org file is in, e.g., an empty directory, there is no such cljs configuration file. -- Bastien
Re: [PATCH] Re: ob-clojure.el: Add ClojureScript interface
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 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 tested your method, true. And I also pulled that latest ob-clojure.el changes. Works great, I like this new method more. Thanks for your improvement. > >> 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. The clojurescript support has a ~:target~ header argument to tell CIDER this is a clojurescript code, I don't know CIDER internal much, but CIDER eval should eval in a ClojureScript corresponding REPL. - -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 -BEGIN PGP SIGNATURE- iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl5L4CcUHG51bWJjaGls ZEBnbWFpbC5jb20ACgkQG13xyVromsNx/Af/U3ZqKwelFTr0IO1evplCY/qHk4ON ICousQWbMmv29665xhI9fkxBFMSXSE6fb7LJadfPK/7NWVfl/OIP4rotmp3mICow FKzYuJ032MSiQma43LCADbXci8x7sTLUo5FlHI2pA6srypaqL4TcNIGnbVjO5UNg WGmYJwAr8pwnXls6sF8JkZB4e+NEtvQl3rhZtDxzfKYHIaz2OYJJ7ELJuEl4IB1G TQz+yzKgSdVeypHGj/t+Q0l2jTLDMFvrCOg/e0OWvuy2DSw4L/CEiS2NIv4CFftC qj0FWOnt5+GPzzpMGoaNpu5LZNoWWlrV99Jv9F2TeU/fNIgMdq+LASsrIw== =g/L7 -END PGP SIGNATURE-
Re: [PATCH] Re: ob-clojure.el: Add ClojureScript interface
Tim Cross writes: > Thanks for the response and work Bastien. I will check out the updated > version when I get a chance. Thanks. > One point possibly relevant with regards to Clojurescript. I suspect > there could be a reasonable use case when you consider clojurescipt in > the context of node rather than just as a browser language. In > particular, people have been using clojurescript to develop NPM packages > that can be used in various ways for javascript projects. However, the > right tool for doing this is likely shadow-cljs rather than clojure CLI > tools - though it should also be possible just using the CLI tools. Yes, I understand the need. But the Clojure ecosystem is so rich in tools that we need to get direct contributions from people using those tools *and* Org babel. Or at least make tests on how it could work. I hope volunteers can help! Cheers, -- Bastien
Re: [PATCH] Re: ob-clojure.el: Add ClojureScript interface
Thanks for the response and work Bastien. I will check out the updated version when I get a chance. One point possibly relevant with regards to Clojurescript. I suspect there could be a reasonable use case when you consider clojurescipt in the context of node rather than just as a browser language. In particular, people have been using clojurescript to develop NPM packages that can be used in various ways for javascript projects. However, the right tool for doing this is likely shadow-cljs rather than clojure CLI tools - though it should also be possible just using the CLI tools. Tim Bastien writes: > Hi Tim, > > thanks for your email. > > Tim Cross writes: > >> I wonder if it would make sense to use shadow-cljs rather than cider as >> a back end for evaluating clojurescript? > > I am inclined to question the usefulness of evaluating ClojureScript > code *at all*. > >> More generally, I wonder if there would be any benefit in considering a >> Clojure CLI Tools back end integration and bypassing CIDER altogether? > > Yes, I agree this would be better. > > I implemented (in master now) the support of inf-clojure.el to > evaluate Clojure blocks. > > Inf-clojure is more lightweight than cider. > > Also, with (setq org-babel-clojure-backend 'inf-clojure) you can now > add a :alias header arg to the src block and "clojure -Aalias" will > then be called to launch the repl. > >> 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. > > Yep, I agree again. > >> 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. > > I am not sure it is worth getting rid of inf-clojure.el altogether, > but relying on tools.deps seems the way to go. > >> 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? > > Definitely! Thanks for sharing these idea. > > Please try the latest ob-clojure.el from master and let me know what > can be improved to better fit your (and others') needs. > > Thanks, -- Tim Cross
Re: [PATCH] Re: ob-clojure.el: Add ClojureScript interface
Hi Tim, thanks for your email. Tim Cross writes: > I wonder if it would make sense to use shadow-cljs rather than cider as > a back end for evaluating clojurescript? I am inclined to question the usefulness of evaluating ClojureScript code *at all*. > More generally, I wonder if there would be any benefit in considering a > Clojure CLI Tools back end integration and bypassing CIDER altogether? Yes, I agree this would be better. I implemented (in master now) the support of inf-clojure.el to evaluate Clojure blocks. Inf-clojure is more lightweight than cider. Also, with (setq org-babel-clojure-backend 'inf-clojure) you can now add a :alias header arg to the src block and "clojure -Aalias" will then be called to launch the repl. > 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. Yep, I agree again. > 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. I am not sure it is worth getting rid of inf-clojure.el altogether, but relying on tools.deps seems the way to go. > 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? Definitely! Thanks for sharing these idea. Please try the latest ob-clojure.el from master and let me know what can be improved to better fit your (and others') needs. Thanks, -- Bastien
Re: [PATCH] Re: ob-clojure.el: Add ClojureScript interface
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
Re: [PATCH] Re: ob-clojure.el: Add ClojureScript interface
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. -- Bastien
Re: [PATCH] Re: ob-clojure.el: Add ClojureScript interface
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Bastien writes: > Hi Stardiviner, > > stardiviner writes: > >> About this patch, last night, I try to test ob-clojurescript eval with CIDER >> connection. But no luck, the ClojureScript REPL connection always failed to >> start. I have problem on CIDER. So I have a request that can you take a test. >> Because on my side, ~(cider-current-connection "cljs")~ returns ~nil~ unable >> to >> test. > > I was able to execute #+begin_src clojurescript source blocks only > when the containing Org file is itself within a project where cider > knows how to launch a clojurescript nrepl. This is what I tried to > convey in the ORG-NEWS entry: > > You can now use =#+begin_src clojurescript= and execute > ClojureScript code from Org files. You will need to put the file in > an directory from where ClojureScript knows how to start a nrepl > connection: e.g. you can put your Org file at the root of a > figwheel-main directory. 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 guess this should work for ClojureScript src block too. > > There was no patch attached to your email, can you resend it? > You already applied patches. I already checked latest master of Org Mode source code. - -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 -BEGIN PGP SIGNATURE- iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl5GuZEUHG51bWJjaGls ZEBnbWFpbC5jb20ACgkQG13xyVromsNd9wf7BNRVjn52wjYJtO+FEZXXfoWFuhZg qCYqd6LhWL8tC3/aLEYmomWD0nLyz4QzOsxD9hliRRl1KNc+JYTRU9b5Si901l23 FPQQdGWxX6LqdRPx9TUg4IToo1AM1qNfRnZXq4lDvpDgO/NxWldeF14681RkgM16 W3OLa5FnW3eHxsLrFf7OIbxKyQRlT8W+GSx7GTaQgbZanKB8Z16mIZ9GYAl97VA9 nbUNg6SjddWmzwoDihAl3f+LLSKjtdTN+jeSeL2RNr/w/1dm6rjpCJKvCxTTmbV8 ruo6AAfvtP1msKvwGHpyoO9MhmqWMIAg+U+HVjk09baZVx2dxLox/YVrbg== =cFe+ -END PGP SIGNATURE-
Re: [PATCH] Re: ob-clojure.el: Add ClojureScript interface
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Bastien writes: > stardiviner writes: > >> I've already signed FSF papers before. Actually I contributed some >> patches already. :) > > Argh, yes, sorry, my bad! I was confused because I saw TINYCHANGE in > previous commit messages. It's fine, I know you read many emails, Forgetting some minor stuff is excusable. - -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 -BEGIN PGP SIGNATURE- iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl5GuhoUHG51bWJjaGls ZEBnbWFpbC5jb20ACgkQG13xyVromsPZigf+I9N8O/sK59GjD3VnLfYo6Yj1G6cQ FK1a+nZlxFJ/UGMOY5n+pX7LID+RXKOKyoEHflD8ZGJpz24Th8Ai+rdSPbjNjIXA ru0EsR553T1TY+6+UQRy2OGmghZcWRWfcnw5iiqJj1NlI3+i2dAiXlrvLSdk7VZG wumwqnfeyB9atVua/q6WXl8eVnvLfFFZmBgb/NXLebu94484Yz/h4QAtAhhpQPrT cVVaP3IKzSuYfatgVLMa59uQuEk8tmOjClaQ8pZbJU5S0R9urR5LNAeFBQI3IyVP bzVdTJWLjUuPCRcxk/xMdcZG3J78Sg94GNG4ZDLDi+bzDqFLjOZopXOaxg== =VuDO -END PGP SIGNATURE-
Re: [PATCH] Re: ob-clojure.el: Add ClojureScript interface
Hi Stardiviner, stardiviner writes: > About this patch, last night, I try to test ob-clojurescript eval with CIDER > connection. But no luck, the ClojureScript REPL connection always failed to > start. I have problem on CIDER. So I have a request that can you take a test. > Because on my side, ~(cider-current-connection "cljs")~ returns ~nil~ unable > to > test. I was able to execute #+begin_src clojurescript source blocks only when the containing Org file is itself within a project where cider knows how to launch a clojurescript nrepl. This is what I tried to convey in the ORG-NEWS entry: You can now use =#+begin_src clojurescript= and execute ClojureScript code from Org files. You will need to put the file in an directory from where ClojureScript knows how to start a nrepl connection: e.g. you can put your Org file at the root of a figwheel-main directory. > I think this patch should work. Just for confirm. There was no patch attached to your email, can you resend it? Thanks, -- Bastien
Re: [PATCH] Re: ob-clojure.el: Add ClojureScript interface
stardiviner writes: > I've already signed FSF papers before. Actually I contributed some > patches already. :) Argh, yes, sorry, my bad! I was confused because I saw TINYCHANGE in previous commit messages. -- Bastien
Re: [PATCH] Re: ob-clojure.el: Add ClojureScript interface
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 About this patch, last night, I try to test ob-clojurescript eval with CIDER connection. But no luck, the ClojureScript REPL connection always failed to start. I have problem on CIDER. So I have a request that can you take a test. Because on my side, ~(cider-current-connection "cljs")~ returns ~nil~ unable to test. I think this patch should work. Just for confirm. Thanks in advance. Bastien writes: > Hi, > > stardiviner writes: > >> And patches in attachments. > > Applied, thanks. > > I made some minor modifications: > > - I added the TINYCHANGE cookie in both messages > - I replaced "ob-clojure.el: (...)" by "ob-clojure.el (...):" > > In general, try `C-x 4 a' on a change, either from magit or from > the modified buffer: this will format a correct changelog entry. > > Also, users may need to figure out that ClojureScript src blocks > need a proper environment to execute src blocks. I.e. we should > recommend users to have their .org file within a ClojureScript > project -- I added something along these lines in the ORG-NEWS > entry. > > If you want to contribute further, you'd need to sign the FSF > papers: https://orgmode.org/request-assign-future.txt > > Thanks! - -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 -BEGIN PGP SIGNATURE- iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl5GLv4UHG51bWJjaGls ZEBnbWFpbC5jb20ACgkQG13xyVromsMkfAf/fFCfp91u8ZtK9VyVjlpf+tZ0wZzU 7d0OPcbnEtUZH/FkGyG2eFgXN/WBnf8O31ESj5EyXtnDGNZSa3Ia/cgmC7ZtCJRp 9w7YbwPnfM9EBq5qK7R+9i6fCEcua5i4Oszx4x1erWuksfGogCdKN6gwZJMYlH5y lqdGQ0LCZMnTxDHn4mi8JuM2K0kaaIK4oJMJmCLu8+/X6lvTbLjGsTl08dew0Pbx jMEkV/3FvtFNeS7MZIIrZedPgAhiS3o6IUj+hmngVpKdcabOZmBkV5IFgvMB77Us SuSKs3Y9Y4hlWZyBMV2Twc4lKicnO31vGJm9MmFn4LCjI3Fd5O6LFEnL0A== =GDMy -END PGP SIGNATURE-
Re: [PATCH] Re: ob-clojure.el: Add ClojureScript interface
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Bastien writes: > Hi, > > stardiviner writes: > >> And patches in attachments. > > Applied, thanks. Great! > > I made some minor modifications: > > - I added the TINYCHANGE cookie in both messages > - I replaced "ob-clojure.el: (...)" by "ob-clojure.el (...):" > > In general, try `C-x 4 a' on a change, either from magit or from > the modified buffer: this will format a correct changelog entry. A good advice tip. I will use it. Thanks. > > Also, users may need to figure out that ClojureScript src blocks > need a proper environment to execute src blocks. I.e. we should > recommend users to have their .org file within a ClojureScript > project -- I added something along these lines in the ORG-NEWS > entry. > > If you want to contribute further, you'd need to sign the FSF > papers: https://orgmode.org/request-assign-future.txt > I've already signed FSF papers before. Actually I contributed some patches already. :) > Thanks! - -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner, Matrix: stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 -BEGIN PGP SIGNATURE- iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl5GLL8UHG51bWJjaGls ZEBnbWFpbC5jb20ACgkQG13xyVromsOS7wf/XjDmlqgD0Us1RgDtarIXAfJDgIjy +S8tEgeSHJSmPFSpifDyYSxAKwRGE1b5v/uUHcxECCana9k8iQ/T7VwFb6vY8XNY NzpM1ZAErSNaOcFWOVH4yEoA8d6V/2Jir7p/SEblZid9HOC9zNpOzw4PxYr81/r5 Mof4/cQnwj1W6Z5MUqVj4rSotx3pBy1TqxCleGXj4EFsRBnJ6RMgvH+x3BYnLBAT 6zhle6hFrJtQGdiaH6YRHJ2ln52LTlozqnLCE2ROsp+ZDnS4lS5gp+2RIDnYPxq1 rszeDHWhAJcwmhPEikMzbmOGvy6X+nljVbLFJOzkFfsSkqFcam+onkLMzw== =T3Qi -END PGP SIGNATURE-
Re: [PATCH] Re: ob-clojure.el: Add ClojureScript interface
Hi, stardiviner writes: > And patches in attachments. Applied, thanks. I made some minor modifications: - I added the TINYCHANGE cookie in both messages - I replaced "ob-clojure.el: (...)" by "ob-clojure.el (...):" In general, try `C-x 4 a' on a change, either from magit or from the modified buffer: this will format a correct changelog entry. Also, users may need to figure out that ClojureScript src blocks need a proper environment to execute src blocks. I.e. we should recommend users to have their .org file within a ClojureScript project -- I added something along these lines in the ORG-NEWS entry. If you want to contribute further, you'd need to sign the FSF papers: https://orgmode.org/request-assign-future.txt Thanks! -- Bastien