aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Dalziel <tom_dl@hotmail.com>2021-02-14 17:10:26 +0000
committerTom Dalziel <tom_dl@hotmail.com>2021-02-14 17:12:32 +0000
commitbbab602e141a2427447288556cd6e519b87663dc (patch)
tree76713b755ab36c09af77f0704896917fba835a1e
parent0febaddaf0e945f878184b58be2ece9293390ab0 (diff)
Improve documentation, lowercase marks only, better tests
-rw-r--r--evil-commands.el17
-rw-r--r--evil-tests.el63
2 files changed, 43 insertions, 37 deletions
diff --git a/evil-commands.el b/evil-commands.el
index f7911da..bca7848 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -673,10 +673,13 @@ and jump to the corresponding one."
(backward-char))
(defun evil--next-mark (forwardp)
+ "Move to next lowercase mark.
+Move forward if FORWARDP is truthy or backward if falsey.
+Loop back to the top of buffer if the end is reached."
(let* ((pos (point))
(markers (cl-remove-if-not
- (lambda (x) (or (markerp (cdr x))
- (<= ?a (car x) ?z)))
+ (lambda (x) (and (markerp (cdr x))
+ (<= ?a (car x) ?z)))
evil-markers-alist))
(sorted-markers (sort markers
(lambda (a b) (< (cdr a) (cdr b))))))
@@ -698,7 +701,7 @@ and jump to the corresponding one."
(goto-char (marker-position (cdar descending-markers)))))))))
(evil-define-motion evil-next-mark (count)
- "Go to [count] next mark."
+ "Go to [count] next lowercase mark."
:keep-visual t
:repeat nil
:type exclusive
@@ -707,17 +710,18 @@ and jump to the corresponding one."
(evil--next-mark t)))
(evil-define-motion evil-next-mark-line (count)
- "Go to [count] line of next mark."
+ "Go to [count] line of next lowercase mark after current line."
:keep-visual t
:repeat nil
:type exclusive
:jump t
(dotimes (_ (or count 1))
+ (evil-end-of-line)
(evil--next-mark t)
(evil-first-non-blank)))
(evil-define-motion evil-previous-mark (count)
- "Go to [count] previous mark."
+ "Go to [count] previous lowercase mark."
:keep-visual t
:repeat nil
:type exclusive
@@ -726,12 +730,13 @@ and jump to the corresponding one."
(evil--next-mark nil)))
(evil-define-motion evil-previous-mark-line (count)
- "Go to [count] line of previous mark."
+ "Go to [count] line of previous lowercase mark before current line."
:keep-visual t
:repeat nil
:type exclusive
:jump t
(dotimes (_ (or count 1))
+ (evil-beginning-of-line)
(evil--next-mark nil)
(evil-first-non-blank)))
diff --git a/evil-tests.el b/evil-tests.el
index d55941e..4af6fcb 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -5205,40 +5205,41 @@ Below some empty line."))
(ert-deftest evil-test-next-mark ()
"Test `evil-next-mark', `evil-previous-mark'"
:tags '(evil motion)
- (ert-info ("Can move to next mark and next mark line")
- (evil-test-buffer
- "line 1
-lin[e] 2
-line 3"
- ("majmbgg")
- "[l]ine 1
-line 2
-line 3"
- ("]`")
- "line 1
-lin[e] 2
-line 3"
+ (ert-info ("Can move to next mark, next mark line,
+previous mark and previous mark line")
+ (evil-test-buffer
+ "[a]lpha bravo
+charlie delta echo
+foxtrot golf hotel
+india juliet"
+ ("ma" "w" "mb" "w"
+ "mc" "w" "md" "w" "me" "w"
+ "mf" "w" "mg" "w" "mh" "w"
+ "mi" "w" "mj")
+ "alpha bravo
+charlie delta echo
+foxtrot golf hotel
+india [j]uliet"
+ ("3]`")
+ "alpha bravo
+[c]harlie delta echo
+foxtrot golf hotel
+india juliet"
("]'")
- "line 1
-line 2
-[l]ine 3"))
- (ert-info ("Can move to previous mark and previous mark line")
- (evil-test-buffer
- "li[n]e 1
-line 2
-line 3"
- ("mcjmdG")
- "line 1
-line 2
-[l]ine 3"
+ "alpha bravo
+charlie delta echo
+[f]oxtrot golf hotel
+india juliet"
("[`")
- "line 1
-li[n]e 2
-line 3"
+ "alpha bravo
+charlie delta [e]cho
+foxtrot golf hotel
+india juliet"
("2['")
- "line 1
-[l]ine 2
-line 3")))
+ "alpha bravo
+charlie delta echo
+foxtrot golf hotel
+[i]ndia juliet")))
(ert-deftest evil-test-flyspell-motions ()
"Test flyspell motions"