expez / evil-smartparens

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

evil-sp-change behaves differently than sp-change outside its use case #20

Closed Alexander-Miller closed 9 years ago

Alexander-Miller commented 9 years ago

To reproduce the issue start emacs -q, load and activate evil-mode, smartparens-strict-mode and evil-smartparens mode.

When sp-evil-change word or cw is called on text "|foo bar" what remains is "bar".

Without evil-smartparens-mode cw leaves " bar", meaning it does not delete the space after "foo".

So sp-evil-change is changing evil's behaviour in a case where it shouldn't. At least I don't see a reason for the difference.

I'm running emacs version 25.0.50.1 and the newest verions of evil, smartparens and evil-smartparens that el-get will give me.

expez commented 9 years ago

Hmm, this difference is indeed unfortunate. evil is consistent with vim, but to my eyes vim is inconsistent:

dw on ([f]oo bar) gives (bar) but cw gives ( bar).

When I debug evil-sp-change the value for end coming in is off-by-1 compared to the end value being passed to evil-change.

I've used the same interactive arguments as evil-change: "<R><x><y>", but the documentation on these are sparse so I might've done something wrong.

Any idea how I got into this situation, @lyro?

braham-snyder commented 7 years ago

Unfortunately, the fix for this erroneously prevents evil-sp-change from removing whitespace (often one final space) in certain cases--for example, the following leave an extra space: c2l on word[,] another; cl on word[ ]another; ciw on word [ ] another. Sometimes no space is removed, like with ch or cl on word [ ] another.

https://github.com/noctuid/lispyville/ has similar safe operators for evil which exhibit the bug detailed in this issue's OP--is this caused by a bug in evil? For what it's worth, evil has new maintainers and a new repo here: https://github.com/emacs-evil/evil/.

expez commented 7 years ago

Yeah, this probably wasn't a very good fix. I even noted in the commit message that it was hacky. Unfortunately, I don't have the time to dig into this right now, but I'd love a PR if you're so inclined :)