From 7b2237963e640ef9ed8b3bae26785fd37dae80dd Mon Sep 17 00:00:00 2001 From: "Paul A. Patience" Date: Thu, 3 Feb 2022 23:44:49 -0500 Subject: [PATCH] Fix lispy-backward-kill-word delimiter-balancing * lispy.el (lispy-backward-kill-word): When looking back at ") ", we would take the first if's then branch because the char before is whitespace. However, this branch would call backward-kill-word which doesn't skip over delimiters. Prevent this situation by taking the then branch only if we're looking back at a word or symbol constituent followed by whitespace, in which case backward-kill-word behaves correctly. If we're not looking back at such a pattern, we end up in the else branch, which does skip over delimiters. Fixes #584 --- lispy.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lispy.el b/lispy.el index d61a5ec5..f4b9735f 100644 --- a/lispy.el +++ b/lispy.el @@ -1223,8 +1223,9 @@ If position isn't special, move to previous or error." (lispy-dotimes arg (when (lispy--in-comment-p) (skip-chars-backward " \n")) - (if (memq (char-syntax (char-before)) - '(?w ?_ ?\s)) + (if (and (memq (char-syntax (char-before)) + '(?w ?_ ?\s)) + (lispy-looking-back "\\(?:\\sw\\|\\s_\\)\\s-+")) (if (lispy-looking-back "\\_<\\s_+") (delete-region (match-beginning 0) (match-end 0))