lispy icon indicating copy to clipboard operation
lispy copied to clipboard

lispy-backward-kill-word does not balance parens, quotes, brackets, or braces

Open rgkirch opened this issue 3 years ago • 1 comments

[[:a]
 ]

If I have the point on the second line after the space and before the close bracket then lispy-backward-kill-word will create

[[:]

another example

[{:a :b}
 ]

gives

[{:a :]

I'm on the latest emacs in master c24766c4d59bc7d9f583f299b1558e2356fba933 from Tue Mar 23 and the latest from lispy 38a7df4cbb16cfe3d62dc8ea98b50e2d9a572e58 Thu Jan 21.

rgkirch avatar Mar 27 '21 22:03 rgkirch

It affects anything where point begins after a space. So another example:

(((:x))) |

gives

(((:x

The problem is the "else" section of:

(if (lispy-looking-back "\\_<\\s_+") 
  ...
  (backward-kill-word 1)

That final line should just fall through to the following (if (setq bnd (lispy--bounds-string)) ... block.

But that whole function is too hairy to understand; it's clearly grown over time. So this part… deletes a single backslash after the killed word, but only if point is in a string and immediately following a space (?!) If I tried to fix it I'd be too afraid of breaking something else.

ComedyTomedy avatar Mar 31 '21 01:03 ComedyTomedy