emacs-evil / evil-surround

you will be surrounded (surround.vim for evil, the extensible vi layer)
Other
627 stars 60 forks source link

No surrounding delimiters found in simple parenthesis case #210

Closed Schievel1 closed 5 months ago

Schievel1 commented 5 months ago

Hi,

I am setting my emacs to text-mode for this because I heard there are some issues with other major modes sometimes.

when I have a simple thing like this:

(abc)

and I put point inside the parenthesis, say on b for example, then I press ds( it says "No surrounding delimiters found" in the minibuffer.

I noticed that when I have

abc

for example, put point on b and press ysiw( it inserts parenthesis like this:

( abc )

And with this, ds( works.

It's as if it notices my (-Keypress as ( (with the space after it) instead of (

tomdl89 commented 5 months ago

Hi @Schievel1 I remember this was a bug for a while, but as I can't reproduce it now, I wonder if you're on a slightly older version of evil-surround?

Schievel1 commented 5 months ago

Probably yes, I am using it from doom emacs and they usually pin packages to certain commits. Since I am on the newest doom emacs I guess this is the commit I am using: da05c60b0621cf33161bb4335153f75ff5c29d91

https://github.com/doomemacs/doomemacs/blob/da3d0687c5008edbbe5575ac1077798553549a6a/modules/editor/evil/packages.el#L17

tomdl89 commented 5 months ago

Ah, in that case you are on a recent enough version. I'm a bit stumped in that case.

By the way, the ysiw( behaviour is expected. You can either do ysiw) instead or you can update the pairs alist:

(push (cons ?\( (cons "(" ")")) evil-surround-pairs-alist)
tomdl89 commented 5 months ago

Ah, it looks like evil-embrace is used by doom as well, so maybe check with that disabled / not loaded?

Schievel1 commented 5 months ago

You say ysiw( inserting spaces is expected behavior. So is ds( want to delete ( + ) parethesis (with spaces). Isn't it expected behavior as well, that it can't find ( in (abc) (for the lack of spaces)? Or is it supposed to actually notice that and delete the parenthesis even though the spaces are missing?

tomdl89 commented 5 months ago

Yeah, it's supposed to be asymmetrical. So using ( for adding parens gives you spaces too, but using ( for deleting parens is tolerant of either parens with spaces or parens without.

tomdl89 commented 5 months ago

Just installed evil-embrace to test this. It is causing the bug. I suggest a bug report there.

Schievel1 commented 5 months ago

Yes I noticed that as well. Thanks for the quick help.