edpaget / parinfer-mode

Emacs Mode for Parinfer
GNU General Public License v3.0
91 stars 10 forks source link

Is this complete? #3

Open Immortalin opened 8 years ago

Immortalin commented 8 years ago

Hi! Is this complete?

shaunlebron commented 8 years ago

i think there might have been some hiccups due to porting the original clojure implementation. I think the new parinfer.js implementation will be much faster/simpler to port. Just a heads up.

Immortalin commented 8 years ago

@shaunlebron any plans?

shaunlebron commented 8 years ago

I'm pretty sure anyone familiar with Emacs Lisp can step up and port parinfer.js in a day if they wanted to. The Python port was done just yesterday because it's easier to port now.

I'm not familiar with Emacs/Elisp, so I'm gonna leave it to someone who does. (cc: @edpaget, @dongcarl, @randre03)

edpaget commented 8 years ago

Nope this is not complete, though it does work-ish. I was attempting to rpc from node. I'll look at parinfer.js and see about porting that instead.

ryepesg commented 8 years ago

Excuse my ignorance, but how it compares to adjust-parens plus aggressive-indent?.

I read some discussion here, here and here, but I'm still without a clue.

randre03 commented 8 years ago

@ryepesg I suggest looking at @shaunlebron's original website on parinfer - http://shaunlebron.github.io/parinfer/, so you can see from many different perspectives what parinfer is. Doubt you'll find it is totally different but it might offer enough changes to your workflow to be of benefit...then again it might not. Compare it for yourself.

If you are unclear about the central idea behind it, the way I view it is that right now without parinfer I need tools, keystrokes, and a small amount of brainpower and memory to manage my parens and indentation when working with a LISP. With parinfer we swap the need for brainpower and keystrokes with an algorithm that makes certain inferences regarding either parens or indentation. Just as it can be very difficult to do maths with two variables, the inference algorithm cannot do its job if it must infer about both indentation and parens at the same time...so the developer makes this choice during each editing session. As @shaunlebron has written, we can think of this along the lines of Vim's modal editing. As a result, the only "keystrokes" the developer is charged with knowing is the one she/he defines to switch between paren/indentation mode and Tab - to adjust either the indentation or the parentheses, and that's all that is required. Therefore, instead of needing multiple packages - one for managing parens and one to manage indentation as well as needing to learn (or re-learn) or to clutter up the memory with dozens of formatting-related keysrokes, Parinfer allows you to rely on one package and two keystrokes to do the same job. Anything else it may do is just dessert.

ryepesg commented 8 years ago

Great answer, thank you very much.

shaunlebron commented 8 years ago

@randre03 couldn't have said it better myself :+1:

edpaget commented 8 years ago

Maybe it works now?

gilch commented 8 years ago

I think the new parinfer.js implementation will be much faster/simpler to port. Just a heads up. [...] I'm not familiar with Emacs/Elisp, so I'm gonna leave it to someone who does.

The js version port to elisp has been done now: https://github.com/oakmac/parinfer-elisp

You could probably replace the library with that for your package.