Skip to content

Commit 338fa76

Browse files
committed
Fixup lispy-splice
* lispy.el (lispy--delete-quote-garbage): New defun. (lispy-splice): Update. (lispy-delete): Update. * lispy-test.el (lispy-splice): Add test.
1 parent a9feba8 commit 338fa76

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

lispy-test.el

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ Insert KEY if there's no command."
704704
"(a ~b c|)"))
705705
(should (string= (lispy-with "(a |'(b c)~)" "/")
706706
"(a |b c~)"))
707+
(should (string= (lispy-with "(a '(b c)|)" "/")
708+
"(a b c)|"))
707709
(should (string= (lispy-with "(asdf)\n(progn\n |(foo)\n (bar))\n(asdf)" "//")
708710
"(asdf)\n|(progn\n foo\n bar)\n(asdf)"))
709711
(should (string= (lispy-with "(asdf)\n(progn\n (foo)\n (bar)|)\n(asdf)" "//")

lispy.el

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,12 +1041,7 @@ If position isn't special, move to previous or error."
10411041
(lispy-left 1))
10421042

10431043
((lispy-left-p)
1044-
(when (lispy-looking-back "\\(?:\\s-\\|^\\)[`',@]+")
1045-
(delete-region
1046-
(match-beginning 0)
1047-
(match-end 0))
1048-
(insert " "))
1049-
1044+
(lispy--delete-quote-garbage)
10501045
(lispy-dotimes arg
10511046
(lispy--delete)))
10521047

@@ -1063,6 +1058,11 @@ If position isn't special, move to previous or error."
10631058
(t
10641059
(delete-char arg)))))
10651060

1061+
(defun lispy--delete-quote-garbage ()
1062+
"Delete any combination of `',@ preceeding point."
1063+
(let ((pt (point)))
1064+
(skip-chars-backward "`',@")
1065+
(delete-region (point) pt)))
10661066

10671067
(defun lispy--delete-whitespace-backward ()
10681068
"Delete spaces backward."
@@ -2033,6 +2033,7 @@ Return the amount of successful grow steps, nil instead of zero."
20332033
(save-excursion
20342034
(goto-char (cdr bnd))
20352035
(delete-char -1))
2036+
(lispy--delete-quote-garbage)
20362037
(delete-char 1)
20372038
(lispy-forward 1)
20382039
(lispy-backward 1))
@@ -2041,7 +2042,9 @@ Return the amount of successful grow steps, nil instead of zero."
20412042
(setq bnd (lispy--bounds-dwim))
20422043
(delete-char -1)
20432044
(goto-char (car bnd))
2044-
(delete-char 1)
2045+
(let ((pt (point)))
2046+
(re-search-forward lispy-left nil t)
2047+
(delete-region pt (point)))
20452048
(lispy-backward 1)
20462049
(forward-list))
20472050

0 commit comments

Comments
 (0)