chlorine-clover

About Chlorine for Atom and Clover for VS Code: https://atom.io/packages/chlorine and https://marketplace.visualstudio.com/items?itemName=mauricioszabo.clover
2019-06-28T22:41:18.004600Z

OK, seancorfield's videos have convinced me that maybe this is the first time in a very long time that I should at least try out another editor/IDE, Atom.

2019-06-28T22:42:01.005600Z

I installed latest Atom, and Chlorine, and ran a clj process with the socket REPL options mentioned on the Chlorine getting started instructions, and was able to connect to it and have a REPL tab/frame seen in Atom, next to my .clj source file.

2019-06-28T22:43:12.006600Z

I may be doing something odd, and was curious what might be going on under the covers a little bit. I was in a source file for namespace foo.bar, and in a comment block at the end I have (require '[foo.bar :as f]) followed by some other forms to evaluate that use the alias f/fn-name-inside-foo.bar

2019-06-28T22:44:03.007500Z

That works fine if you just copy and paste it to a terminal REPL, but may be causing me difficulties when I use Chorine's evaluate-block command.

2019-06-28T22:45:04.008500Z

Is there magicalness in Chlorine's evaluate-block that always tries to evaluate code sent via evaluate-block in the same namespace as the source code editor frame?

seancorfield 2019-06-28T22:46:57.008700Z

Correct.

seancorfield 2019-06-28T22:47:09.009Z

Block evaluation is done in the context of the namespace.

2019-06-28T22:48:19.009900Z

thanks, that makes sense. I had been using Emacs inf-clojure with lein and/or clj, and I believe its 'evaluate in REPL' capability doesn't have that behavior, so threw me off.

seancorfield 2019-06-28T22:48:47.010600Z

Yeah, it's a small piece of "magic" but it makes the behavior in general much more intuitive.

2019-06-28T22:48:56.010900Z

So Chlorine's evaluate-block is probably sending (in-ns 'foo.bar) forms at appropriate times over the socket REPL?

seancorfield 2019-06-28T22:49:48.011100Z

Correct.

seancorfield 2019-06-28T22:50:21.012Z

If you're curious about also using REBL with Chlorine, https://github.com/seancorfield/atom-chlorine-setup has more REBL-specific commands and modified keymaps.

2019-06-28T22:51:52.013800Z

I tried out Atom's vim-mode-plus package due to my extensive vim muscle memory, and found that makes doing evaluate-block for a form that ends with ) as the last character on a line not possible from normal mode. You have to go into insert mode to get the cursor after the ), or have extra whitespace after the ). I can live with it -- it just made me chuckle when I saw what was happening.

seancorfield 2019-06-28T22:54:58.014300Z

I pretty much carried my ProtoREPL bindings over to Chlorine because that's what I'd used for years before.

2019-06-28T23:05:35.014800Z

It appears that Chlorine does not cause new menu items to be created within Atom when it is installed?

2019-06-28T23:05:54.015200Z

So one must create key bindings to take advantage of things like evaluate-block?

seancorfield 2019-06-28T23:11:23.015500Z

Or use the command-palette. Yeah.

mauricio.szabo 2019-06-28T23:28:26.016800Z

Strange that behavior of ). I never had this problem and I do use Chlorine with vim-mode-plus. But yeah, if you put a cursor on the end of the line it'll not evaluate in normal-mode

mauricio.szabo 2019-06-28T23:29:58.018500Z

I think that's because I never evaluate something pointing the cursor at the end of the line. For example, if I have a form: (+ 1 2 (* 3 4)) If I want to evaluate the outer form, I use evaluate-top-block, or my cursor will probably be over 2, 1, +...

2019-06-28T23:32:50.019600Z

Actually, I may have confused myself that it doesn't work. It is doing it now.

mauricio.szabo 2019-06-28T23:35:18.021900Z

Also, a little bit more information, Chlorine's evaluation commands indeed detects the first ns form and send it to REPL. Once I saw a library that uses multiple ns entries in the same file, and it was not working with Chlorine - I'm working on a feature that'll send the correct ns (will scan top-level forms and pick up the previous namespace declaration)

mauricio.szabo 2019-06-28T23:35:45.022800Z

@andy.fingerhut, it only fails if the line ends with two parenthesis ))

2019-06-28T23:36:03.023600Z

OK, more experimentation results. If I have this on a line by itself (def x (+ 5 5)) with no white space at the end, and I am in normal, not insert, mode, then evaluate-block while the cursor is over the last ) evaluates (+ 5 5) only. If I insert a space between the two right parens like this: (def x (+ 5 5) ) then normal mode evaluate-block evaluates the whole def if the cursor is on the last ).

2019-06-28T23:36:41.024500Z

Yeah, kinda makes sense why it would do that.

mauricio.szabo 2019-06-28T23:38:12.025400Z

When you're in normal-mode, if you have 1234, for example, and point the cursor to 3, it doesn't really knows where you are: if you press i, your cursor is between 2 and 3. If you press a, you're between 3 and 4. Schrödinger's Selection? 🐱

2019-06-28T23:44:31.026600Z

Yeah, I've actually used Emacs viper-mode more than vim for a few years, and whoever implemented that actually lets you move the cursor one step to the right after the last character on the line, unlike vim. Not saying that is what Atom vim-mode-plus ought to do, since it is a little weird for vim users.