Skip to content

Commit 1c898ac

Browse files
committed
lispy.el (lispy-mark-car): improve
* lispy-test.el (lispy-mark-car): Add test.
1 parent 5750704 commit 1c898ac

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

lispy-test.el

+4
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,10 @@ Insert KEY if there's no command."
990990
(should (string= (lispy-with "~;; foo|\n(bar)" (lispy-mark-list 1))
991991
"|;; foo\n(bar)")))
992992

993+
(ert-deftest lispy-mark-car ()
994+
(should (string= (lispy-with "|\"foo\"~" (lispy-mark-car))
995+
"\"~foo|\"")))
996+
993997
(provide 'lispy-test)
994998

995999
;;; Local Variables:

lispy.el

+11-7
Original file line numberDiff line numberDiff line change
@@ -2406,13 +2406,17 @@ Second region and buffer are the current ones."
24062406
(interactive)
24072407
(let ((bnd-1 (lispy--bounds-dwim))
24082408
bnd-2)
2409-
(goto-char (car bnd-1))
2410-
(while (and (equal bnd-1 (setq bnd-2 (bounds-of-thing-at-point 'sexp)))
2411-
(< (point) (cdr bnd-1)))
2412-
(forward-char))
2413-
(if bnd-2
2414-
(lispy--mark bnd-2)
2415-
(lispy-complain "can't descend further"))))
2409+
(if (and (eq (char-after (car bnd-1)) ?\")
2410+
(eq (char-before (cdr bnd-1)) ?\"))
2411+
(lispy--mark (cons (1+ (car bnd-1))
2412+
(1- (cdr bnd-1))))
2413+
(goto-char (car bnd-1))
2414+
(while (and (equal bnd-1 (setq bnd-2 (bounds-of-thing-at-point 'sexp)))
2415+
(< (point) (cdr bnd-1)))
2416+
(forward-char))
2417+
(if bnd-2
2418+
(lispy--mark bnd-2)
2419+
(lispy-complain "can't descend further")))))
24162420

24172421
;; ——— Locals: miscellanea ————————————————————————————————————————————————————
24182422
(defvar lispy-mode-x-map (make-sparse-keymap))

0 commit comments

Comments
 (0)