@drewverlee looks like the author isn’t in the clojure community, and therefore not in this slack rom
might wanna ask in the issue here: https://github.com/syl20bnr/spacemacs/issues/5574
oh, looks like @doglooksgood wrote it
thanks @shaunlebron i’ll see if i can’t figure out why my setup doesn’t work.
Here’s an interesting problem I found today.
(reduce-kv (fn [m k v])
{}
{})
If I wrap this by just inserting (
, then it works fine.
If I do it using Cursive’s paredit “wrap with parens” action, I get:
((reduce-kv (fn [m k v]
{
{}})))
Which is clearly not right at all.
This is because the wrap command auto-formats the form after wrapping. So there are 4 changes generated - insert closing )
, insert opening (
, then insert a single space at the start of lines 2 and 3.
The last two are due to the form being formatted at the end of the wrap action.
The problem is that the indent offset is incremented by the auto-format changes, but shouldn’t be.
I initially thought that perhaps I could ignore changes which were whitespace only when at the start of the line in the indent area, i.e. before any actual line content.
But if I do that, then:
(foo)
(bar {:a 1
:b 2})
If I put the caret at the start of (bar
and start pressing space, then the :b 2})
part won’t have its indentation corrected.
Any ideas for a heuristic that might work here?
Actually, having thought about it while doing the dishes, I’m not sure that’s actually the problem. I’ll debug and report back.
@cfleming: you’re right, this is a bug in parinfer
tracking here: https://github.com/shaunlebron/parinfer/issues/173
That looks a bit like the bug I ran into trying the experimental "Smart Mode" last week. I haven't had time to repro yet but it was to do with paren-wrapping and it reformatted (and broke) my code.
(that was with the current Parinfer package for Atom)
@seancorfield thanks for confirming, i’ll look into it. this happened when using with paredit?
@shaunlebron Yes, using lisp-paredit
package in Atom, with the slurp-forwards
command, with Parinfer
package and Smart Mode
enabled.