expez / evil-smartparens

Evil integration for Smartparens
GNU General Public License v3.0
134 stars 17 forks source link

Deleting in strings seems not to work well with smartparens #35

Closed loganmhb closed 8 years ago

loganmhb commented 8 years ago

First off, thanks for this package! I've enjoyed it a lot.

I've noticed that I frequently end up with undeletable characters inside of strings -- for example, I can type this in emacs-lisp-mode:

")"

which Smartparens allows, but then evil-smartparens won't let me delete that closing square bracket because "it will leave the buffer unbalanced" (even though it won't). I took a quick look at the test suite and it appears that protecting against unbalanced parens inside string literals is intentional -- is that the case? If so, could that be made configurable so it could be turned off? I'd be happy to work on a pull request if so.

(When evil and evil-smartparens are both disabled, Smartparens allows deletions of braces within strings, for what it's worth.)

expez commented 8 years ago

Hi

Smartparens is quite thorough, as it balances stuff inside strings and in comments as well. I consider this to be a feature, as it's very rare in prose to use unbalanced delimiters, and whenever you actually need to there are escape hatches (you can hit o, to override and, delete anything in visual state).

I consider the example you provided as a bug in smartparens and opened this issue to have that defect corrected.

If you want to get your hands dirty and submit a PR I think your efforts would be best spent closing that issue :)

loganmhb commented 8 years ago

Thanks for the pointer to that issue - I'm surprised that's default behavior for smartparens even in strict-mode. Seems I wasn't running across this before I started using evil-smartparens because I was accidentally running smartparens and paredit at the same time (don't know how that happened, haha) so paredit was preventing the insert.

For future googlers, I've worked around this problem by rebinding ')', '}' and ']' to sp-up-sexp in insert-mode, which at least solves the most common cases.