Fork me on GitHub

To whoever suggested the combination of aggressive-parens-mode and adjust-parens! Thank you! It's a game changer for me

pizzaspin 4

I remember this chat! we were talking about parinfer


what’s your setup now?


(not my suggestion re aggressive parens etc, was someone else)


aggressive-indent and adjust-parens ?


Ya pretty much, and I use smartparens as well.


I tried parinfer before, but the problem is that it works 85% of the time. If you paste in some badly indented code, or checkout a codebase with bad indentation and open it with pareinfer, it will break the code because it will automatically recompute the parenthesis based on the indentation, and since the indent is wrong, it will do the wrong thing.


It also frustrated me that with parinfer, I can no longer auto-indent.


To remediate that, parinfer assumes you will switch between parens mode and indent mode accordingly. So like siwtch to parens mode before pasting, and then switch back to indent mode, for example.


But this got tedious, and I'd always forget to do so. And then it has smart mode, but in Emacs, that's on a branch, and I didn't try it. They seem to think its not fully working yet. Smart mode is basically parinfer trying to auto switch between indent and parens mode for you. But there's so many things that can modify the buffer that it needs to hook into to be smart, that's why smart mode is hard to implement and get working with everything.


Adjust-parens is like parinfer, but on demand and local to the form you call it on. By pressing TAB or S-TAB when the cursor is at the start of a form, you can basically alter the nesting of the form to its surrounding form. And aggressive-indent-mode means everything is always auto-indented in a smart way. So for example, if you backspace, instead of breaking indent, it will move the line up.


Its really nice, like the best of parinfer and smartparent (which is same as paredit).

👍 4