parinfer

tianshu 2017-07-17T05:54:06.726944Z

It's likely emacs parinfer need rewrite for better performance, I'm not sure if it is possible to process whole buffer in a very short time in elisp.

tianshu 2017-07-17T05:55:35.739108Z

the logic will be quite simple if always process the whole buffer. otherwise I have to find the begin and end for current sexp, that's really difficult.

shaunlebron 2017-07-17T05:56:55.750221Z

yeah, I suppose your choices are 1) make parinfer-elisp faster somehow, or 2) use the parent-expression hack that @chrisoakman used in atom-parinfer

shaunlebron 2017-07-17T05:57:53.758847Z

https://github.com/oakmac/atom-parinfer#known-limitations

tianshu 2017-07-17T05:59:14.770425Z

I use some hack for current version, however a sexp can be very large sometimes, for example, config.clj. In that situation, I delay the processing until user stop typing. but I don't think it's a good idea.

shaunlebron 2017-07-17T06:03:12.812646Z

just to be clear, why is it bad to process only after user stops typing?

tianshu 2017-07-17T06:05:22.832091Z

if I have a sexp, 1000 lines. I can feel the pause while parinfer processing text.

shaunlebron 2017-07-17T06:06:11.839126Z

I mean, can you clarify this? > I delay the processing until user stop typing. but I don’t think it’s a good idea.

shaunlebron 2017-07-17T06:07:24.850062Z

i would think that the pause does not drastically affect typing if it only happens after they’re done typing

shaunlebron 2017-07-17T06:09:41.870770Z

anyway, we worked pretty hard to ensure parinfer.js was fast for this reason, do you think parinfer-elisp could be made faster? (I haven’t looked at it)

shaunlebron 2017-07-17T06:12:30.896277Z

btw, finally updated the site demo to v3: http://shaunlebron.github.io/parinfer/demo

shaunlebron 2017-07-17T06:13:57.909203Z

made the necessary site changes using @rgdelato’s branch of atom-parinfer, and it feels pretty good, so I removed the mode option from the site demo

rgdelato 2017-07-17T06:23:56.005019Z

Actually, I'm still not sure what's happening with that. Should I make a pull request or is @chrisoakman doing work to move Atom to v3?

tianshu 2017-07-17T06:25:26.020899Z

I want to processing in parallel when user is typing. But don't know how to achieve. also, I'm considering using js version parinfer instead of port it to elisp.

shaunlebron 2017-07-17T06:39:07.164902Z

@rgdelato not sure, maybe DM him to coordinate?

shaunlebron 2017-07-17T06:41:27.190617Z

@doglooksgood neovim-parinfer has had great success with just using js version, and it works really well.

shaunlebron 2017-07-17T06:43:08.208492Z

I think that would save a ton of work if it’s currently possible for emacs plugins to shell out to js

shaunlebron 2017-07-17T14:18:21.592539Z

driving back home today. going to try to get forceBalance tests done tonight since atom-parinfer will be using it

tianshu 2017-07-17T16:41:04.818278Z

how can I try the v3 on atom?

rgdelato 2017-07-17T16:47:13.021473Z

@doglooksgood I have a fork that kinda works, if you already have Atom installed, you can try:

git clone <https://github.com/rgdelato/atom-parinfer.git>
cd atom-parinfer
git checkout cursor-dx-poc
apm install
apm link
...then restart Atom.

chrisoakman 2017-07-17T16:47:53.043556Z

I'll try to push out v3 officially this week.

chrisoakman 2017-07-17T16:47:59.046600Z

For atom-parinfer.

rgdelato 2017-07-17T16:48:03.049084Z

👍

tianshu 2017-07-17T16:53:43.235928Z

thx! @rgdelato

tianshu 2017-07-17T16:54:06.248894Z

I found something not comfortable

tianshu 2017-07-17T16:55:55.309195Z

(defn foo []
  (println {:a 12
            :b 111}
           bar))
when cursor is following println, press backspace, bar will be slurp into {}

tianshu 2017-07-17T17:04:13.591893Z

but I enjoy the behavior in v3 when I insert open paren before another open paren.

tianshu 2017-07-17T17:05:01.618145Z

then I can delete close paren with delete or ^d to do slurp.

shaunlebron 2017-07-17T18:11:30.853997Z

@doglooksgood yeah i call this behavior "sibling adoption" with a test case describe in this section https://github.com/shaunlebron/parinfer/blob/master/lib/test/cases/indent-mode.md#changes

cfleming 2017-07-17T20:45:11.680955Z

@shaunlebron I’d need to try it for real, but I can imagine expecting the same as @doglooksgood

shaunlebron 2017-07-17T22:40:12.468360Z

yeah i think i agree

shaunlebron 2017-07-17T22:41:59.499532Z

that would be inline with @rgdelato's original idea to apply indent mode above and paren mode below the edit

shaunlebron 2017-07-17T22:54:44.716959Z

as always, there are edge cases we have to consider. this would require parinfer to know about sibling alignment

shaunlebron 2017-07-17T22:57:02.755659Z

e.g. if bar was indented by only two spaces, would you expect it to stick to the map after deleting and reinserting println? @doglooksgood @cfleming