From aa19ed6fec73c883442fb4ffd8d300355d5a8580 Mon Sep 17 00:00:00 2001 From: Tom Dalziel <33435574+tomdl89@users.noreply.github.com> Date: Fri, 8 Mar 2024 08:51:48 +0100 Subject: [PATCH] Fix barfing with < on closing paren with preceding form (#114) Fixes #105 --- evil-cleverparens-tests.el | 7 ++++++- evil-cleverparens.el | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/evil-cleverparens-tests.el b/evil-cleverparens-tests.el index 269c152..49ebfce 100644 --- a/evil-cleverparens-tests.el +++ b/evil-cleverparens-tests.el @@ -673,7 +673,12 @@ golf foxtrot deltahotel india")) (evil-cp-test-buffer "alpha bravo (cha[r]lie) delta echo" ("<") - "alpha bravo (cha[r]lie) delta echo"))) + "alpha bravo (cha[r]lie) delta echo")) + (ert-info ("Stay on closing paren when barfing from it") + (evil-cp-test-buffer + "(alpha)\n(bravo charlie delta[)]" + ("<") + "(alpha)\n(bravo charlie[)] delta"))) (ert-deftest evil-cp->-test () (ert-info ("Can do regular forward slurp") diff --git a/evil-cleverparens.el b/evil-cleverparens.el index 336eadf..d3a4f02 100644 --- a/evil-cleverparens.el +++ b/evil-cleverparens.el @@ -1166,7 +1166,8 @@ regular forward-barf." ((evil-cp--looking-at-any-closing-p) (when (not (sp-point-in-empty-sexp)) (when (not (evil-cp--singleton-list-p)) - (sp-forward-barf-sexp) + (let (sp-barf-move-point-with-delimiter) ; It's not helpful here + (sp-forward-barf-sexp)) (sp-backward-sexp) (evil-cp-previous-closing)))) ((evil-cp--singleton-list-p)