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
jaihindhreddy 2020-02-02T19:10:21.029500Z

Did evaluate-block change recently? If I place my cursor at the end of a form and call it, I'm getting back nil. For example, (+ 1 2)| returns nil instead of 3. (| represents cursor position)

seancorfield 2020-02-02T20:37:27.030100Z

@jaihindhreddy It did change but not very recently -- that change was quite a while ago.

jaihindhreddy 2020-02-02T20:38:57.031Z

hmm. It's been quite a while since I've fired up Atom. Was busy with other stuff.

jaihindhreddy 2020-02-02T20:39:10.031500Z

Is there a thing now that can replicate the old behaviour?

jaihindhreddy 2020-02-02T20:39:27.032300Z

i.e, a thing that evals the form just before the cursor

seancorfield 2020-02-02T20:40:33.033100Z

Not that I know of. I know @mauricio.szabo is aware of the change. I don't believe it was intentional, but I get the impression it's hard to fix (without breaking other stuff).

seancorfield 2020-02-02T20:41:21.034400Z

If I'm at the end of a form I want evaluated, I either hit backspace and then ctrl-; b, or ctrl-left then ctrl-; b

💯 1
jaihindhreddy 2020-02-02T20:42:01.034900Z

I understand. Also, I just noticed that evaluate-top-block doesn't ignore comment. Is this also new or was it always like this?

seancorfield 2020-02-02T20:42:47.035200Z

Always like that.

seancorfield 2020-02-02T20:43:52.036600Z

The change to eval form (at end of form) was annoying for a while but I've mostly gotten used to it. Still occasionally catches me out and invokes an eye roll :face_with_rolling_eyes:

1
jaihindhreddy 2020-02-02T20:44:17.036700Z

Thank you for your help!

seancorfield 2020-02-02T20:44:39.037200Z

Probably not the answer you wanted 🙂

🙃 1
mauricio.szabo 2020-02-02T21:10:45.039Z

Yes, it was quite some time ago. The old implementation was using some Atom APIS that were difficult to test and did get confused on things like comments, strings, and so on

mauricio.szabo 2020-02-02T21:13:31.043300Z

It also had problems with repetition of parens. I don't really remember the exact issue, but there were times when you got something like ((some-code)) that it was difficult to evaluate exactly the form you wanted

mauricio.szabo 2020-02-02T21:14:59.044900Z

What I did fix was an issue where you wouldn't get any result if the cursor was in the end of the line and you want to evaluate "top block"

jaihindhreddy 2020-02-02T21:22:33.046200Z

Yup. That is fixed. Can I try and contribute a version of evaluate top block that ignore comments? Just want to know if you have any disagreement with that idea itself.

seancorfield 2020-02-02T21:38:09.048500Z

@jaihindhreddy As someone who uses Rich Comment Forms a lot in my day-to-day work, I don't find that a comment often contains a single form to eval but a sequence of forms to eval step-by-step. If I want a group of expressions to be executed together, I'd wrap them in do and eval that (so I'd still have the option to eval individual forms within the do as well).

mauricio.szabo 2020-02-02T21:39:51.050300Z

Yes, when I want to evaluate a single form inside a comment I use the comment for #_

mauricio.szabo 2020-02-02T21:40:17.051Z

There is already an exception to ignore this form when evaluating

💯 1
seancorfield 2020-02-02T21:40:42.052200Z

If you have

(comment
  (def app (...))
  (def sys (...))
  (some complex expression using app and sys))
what would eval top block do here?

mauricio.szabo 2020-02-02T21:41:42.053700Z

The thing is that there's already a bunch of rules when evaluating blocks and top blocks, I don't think adding a new one will benefit too much...

seancorfield 2020-02-02T21:42:45.054700Z

@jaihindhreddy What about the example I just gave? Three forms inside comment. Without the comment, each of those would be a separate top-level block...

jaihindhreddy 2020-02-02T21:53:37.056300Z

huh. Yup. The way I was picturing it, the version in my head would evaluate only one of those, because it simply doesn't see the comment form. And the current one evaluates the whole thing but along with comment itself so nothing really happens.

sparkofreason 2020-02-03T16:05:00.059200Z

You may be able to get the behavior you describe by adding this code to init.coffee: https://clojurians.slack.com/archives/CF02KPG4U/p1579882065022300