parinfer-mode
parinfer-mode copied to clipboard
Smart mode status?
What's the status of smart mode? Is it ready for prime time? If so, what is the method for installing the smart mode branch?
Thanks.
I'm very sorry to say recently I don't have time on develop work on this project.
the smart mode is almost done on the smart
branch with few known problems in my use case.
1, not work with multiple edit(automatically disabled)
2, every change will refresh the whole buffer, It's fast, but will break cider's hint on fringe and some modes like hideshow
3, will not delete the close parens when delete semicolon for a comment line.
the problem 2 is hard to solve, so I decide to rewrite when have time.
I'm not sure what would be even involved to finish smart mode, so i feel i'm a poor candidate for taking it on. The project seems to have a good bit of interest though, maybe we could start a Patron to help ppl pay you back for this and future work. I just know i would be excited to start using smart mode on emacs
break cider's hint on fringe and some modes like hideshow
can you explain a bit more on what that means?
It seems that this fork has working smart mode: https://github.com/jvshahid/parinfer-mode/tree/master
@jvshahid Any plans to merge your work into this package?
@andreyorst see https://github.com/shaunlebron/parinfer/blob/master/lib/README.md
@andreyorst see https://github.com/shaunlebron/parinfer/blob/master/lib/README.md
and?
Smart mode works fairly well in that implementation, as well as in https://github.com/eraserhd/parinfer-rust. It's just a matter of telling users that it would not work in these specific situations. Also allowing toggling between all three modes as done in Atom and parinfer-rust is a possible way to workaround most these problems.
@andreyorst fair enough -- I haven't used smart mode in a long time and it seemed to me like it was being abandoned, but maybe I was mistaken :)
@jvshahid Any plans to merge your work into this package?
My repo isn't really a fork. I just merged the smart
branch into master, since both had features that I wanted to use. I don't use smart mode anymore, since I encountered a lot of edge cases while using it.
Anyone have some experience with parinfer-rust-mode? It looks promising.
https://github.com/justinbarclay/parinfer-rust-mode
I do. Used it in Kakoune. There were some issues with long running sessions, but performance-wise its good
Although the big point for me is that this package is pure elisp. Which means that it works on my phone, and on PC
I'm going to explore how I can integrate smart mode with paren and indent modes, because currently you're locked into smart mode. If I will figure this out are here willing to accep PR with smart mode? I mean it really works that well for me, I've wrote a lot of Clojure, ELisp, Scheme and Racket in past two weeks and had no issues so far, so it only need a little polish here and there
There is a big problem, I'm still exploring how to make parinfer fast in Elisp. There're so many edge cases if you can't parse the whole buffer.
My first plan is writing a faster indent/paren mode. If this is possible, target to the smart mode.
Glad to hear that you have plans on improving this package
I don't know implementation details, but will it be possible to parse expression inside-out? E.g. if we're inside expression, take this as starting point and expand until reached top level. This will reduce reparsing to current expression as a whole. Of course if whole file is one big expression this is not going to work...
Edit: oh, well, perhaps if parentheses unbalanced such algorithm will misbehave a lot.
In some cases, it is possible to assume we are working on balanced parens, so just run parinfer in a top-level or parent sexp.
But when you do kill, especially those without a region, like kill-line
, it will break. And there are a lot kill commands.
Yeah, I've realized that. I have high hopes for native compilation of emacs lisp. I'm currently using this branch and it is really fast.
I've heard of this, is it require a very long time to compile the Emacs and packages? I also curious about what if implement parinfer in C, provide as a dynamic module. If there's no other dependencies, user only need gcc, make installed, and compile can be done automatically.
I've heard of this, is it require a very long time to compile the Emacs and packages?
Not quite. It's longer, but, and it's a big but, you can compile Emacs as usual, and it will asyncronously compile and load compiled elisp while running:
./autogen.sh && ./configure --with-nativecomp && make NATIVE_FAST_BOOT=1 -j4
I also curious about what if implement parinfer in C, provide as a dynamic module.
I think this can be done, and since there's Rust implementation, I think it can be translated to C pretty much directly for the most part. Although it uses quite a lot of dependencies.
Generally speaking, I really like this idea. I'm using vterm which compiles itself on first launch after update/install and it is quite useful