Hi all. If I select some part of a s-expression including parenthesis (even not balanced) and press del, cursive deletes the selection generating a not-balanced s-expression. From here I can't find any way to re-balance parenthesis. Is there a way to solve this problem ? Thanks
Sometimes I manually select closing paren, copy it to buffer and paste somewhere else to achieve balance. I know it’s dirty technique, but works.
the dirty solution to unbalanced parens with cursive paredit is just copying and pasting closing parens
In addition to “Extend Selection” + backspace, you can also simply “backspace”; With paredit (what I use) it always does the right thing (at least from my perspective); But I agree coming from another language it can be tempting to hold Shift + arrow keys to select portions of the code; Just don’t 🙂 It can take a few weeks to break that muscle memory; I’ve forgotten those times so much that now it’s super hard to code without at least “Extend Selection” in another language; For example, XCode doesn’t have “Extend Selection”, so if I have to write Swift, I use AppCode (by IntelliJ) and use Extend Selection, copy/paste/delete all the time (since there’s no easy+proper structural movement).
Don’t select expressions manually; I personally use “Extend Selection”
(with a keyboard shortcut attached, ofc)
👍
use parinfer
If using paredit you can insert a new balanced pair of parens and then highlight and delete one to leave you with the desired paren to help balancing. But the advice to never get into this state is the more correct way to manipulate forms
All I know is that as long as I keep auto-indenting while using parinfer, I can quite casually highlight and delete most stuff and It Just Works(tm) 😉