8
u/yogthos Nov 11 '15
This is so much better than the Light Table paredit mode, would be a nice replacement for it. :)
1
4
u/antura Nov 11 '15
Amazing. This is the best way to edit s-expressions. No question about it.
There's also an plugin for Atom
5
2
1
u/jamiei Nov 12 '15
Amazing would love to start using this today!
2
u/chrisoakman Nov 16 '15
You can use Parinfer today with the Atom editor: https://atom.io/packages/parinfer
1
Nov 12 '15
This seems very nice! I hope lots of people explore options like this. I personally use lispy: https://github.com/abo-abo/lispy
Its approach is to do special actions when point (the cursor) is on a parenthesis. This works wonderfully well once you get the basic movement commands ingrained in your muscle memory.
1
1
Nov 12 '15
[removed] — view removed comment
7
u/Artiavis Nov 12 '15 edited Nov 12 '15
One of the more sublime aspects of writing Python code is that the code must (to some minimal standard) be legible and cleanly formatted in order to run. In essence, clearly, visually indicating your intent is all it takes to get code to run. Want an extra line in a for loop? Just add it at the relevant level of indentation and it just works. For those with a preference for clear formatting, Python can be a marvel.
What Parinfer does is bring similar flexibility and power to Lisp. Lisp, like C/Java and friends, does not particularly care about the visual clarity of your code as long as all the parens are balanced. Although a powerful tool like Paredit can "read your mind" to the extent that it makes manipulating S-expressions nimble, it doesn't help those who want to express their code clearly. While Paredit can take care of 90% of S-expression manipulation needs, visually rearranging blocks still must be done manually. For someone like myself coming from Python, Paredit can feel a bit like the tail wagging the dog in that I can rearrange valid code all day and still not have it look right. I end up still needing to manually format my code: a minor friction which ultimately detracts from my coding experience.
Parinfer, on the other hand, looks to give all 100% of what I want: powerful S-expression manipulation, through clear code formatting. By clearly formatting my intent, the code structures itself to be valid. I can have my cake and eat it too because I need only do the 10% work, formatting, and the restructuring logically follows.
0
Nov 12 '15
[deleted]
1
u/rpglover64 Nov 12 '15
Yes, but there are limitations.
aggressive-indent, AFAICT, can't preserve local idiosyncrasies to nearly the same extent.5
u/charliegriefer Nov 12 '15
I'm curious about this as well. Currently using paredit mode in Emacs and I'm not quite sure what this buys me that paredit does not?
(disclaimer: It's 1:04 am and I was about to head up to bed... I admittedly only just gave the page a cursory glance... will check back tomorrow morning over coffee)
4
u/john_atx Nov 12 '15
I had to look at it again in the morning to understand. The difference is paredit does explicit commands, it doesn't try to guess what you are trying to accomplish.
This moves parens around automatically by the changes that you make to the code, whereas paredit moves them around only in response to commands that you give it.
20
u/doubleagent03 Nov 11 '15
I would love to see this for Emacs.