Skip to content
This repository has been archived by the owner on Feb 4, 2021. It is now read-only.

Smart mode status? #69

Open
Engelberg opened this issue Oct 29, 2018 · 18 comments
Open

Smart mode status? #69

Engelberg opened this issue Oct 29, 2018 · 18 comments

Comments

@Engelberg
Copy link

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.

@DogLooksGood
Copy link
Owner

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.

@drewverlee
Copy link

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

@drewverlee
Copy link

break cider's hint on fringe and some modes like hideshow

can you explain a bit more on what that means?

@andreyorst
Copy link

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?

@next-mad-hatter
Copy link

@andreyorst
Copy link

@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.

@next-mad-hatter
Copy link

@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
Copy link
Contributor

@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.

@DogLooksGood
Copy link
Owner

Anyone have some experience with parinfer-rust-mode? It looks promising.

https://github.com/justinbarclay/parinfer-rust-mode

@andreyorst
Copy link

andreyorst commented Mar 26, 2020 via email

@andreyorst
Copy link

Although the big point for me is that this package is pure elisp. Which means that it works on my phone, and on PC

@andreyorst
Copy link

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

@DogLooksGood
Copy link
Owner

DogLooksGood commented Apr 11, 2020

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.

@andreyorst
Copy link

andreyorst commented Apr 11, 2020

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.

@DogLooksGood
Copy link
Owner

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.

@andreyorst
Copy link

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.

@DogLooksGood
Copy link
Owner

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.

@andreyorst
Copy link

andreyorst commented Apr 11, 2020

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants