branch: elpa/evil-emacs-cursor-model-mode
commit 78373630ec3357eb6183ae1b7da8b0dc81f46edf
Author: maxfriis <[email protected]>
Commit: GitHub <[email protected]>

    Exception in evil-repeat-find-char if no f/t
    
    Filed bug report with evil so I don't have to work around it long term.
---
 evil-emacs-cursor-model-mode.el | 68 +++++++++++++++++++----------------------
 1 file changed, 32 insertions(+), 36 deletions(-)

diff --git a/evil-emacs-cursor-model-mode.el b/evil-emacs-cursor-model-mode.el
index 8147a8b8fa..30d8175bd9 100644
--- a/evil-emacs-cursor-model-mode.el
+++ b/evil-emacs-cursor-model-mode.el
@@ -182,48 +182,44 @@ Movement is restricted to the current line unless 
`evil-cross-lines' is non-nil.
   :type inclusive
   (interactive "<c>")
   (unless count (setq count 1))
-  (let ((find (eq (car evil-last-find) #'evil-find-char))
-        (char (car (cdr evil-last-find)))
-        (forward (car (cdr (cdr evil-last-find)))))
-    (if (and forward
-             (= char (char-after)))
-        (when (> count 1)
-          (evil-repeat-find-char (1- count))
-          (unless find (forward-char)))
-      (when (or find
-                forward
-                (/= char (char-before))
-                (> count 1))
-        (when (or find (/= char (char-after (1+ (point)))))
-          (evil-repeat-find-char count))
-        (when (and (not find) forward) (forward-char))))
-    (when (and find forward) (forward-char))
-    (setq evil-last-find
-          (list (if find #'evil-find-char #'evil-find-char-to) char forward))))
+  (if evil-last-find
+      (let ((find (eq (car evil-last-find) #'evil-find-char))
+            (char (nth 1 evil-last-find))
+            (fwd (nth 2 evil-last-find)))
+        (if (and fwd (= char (char-after)))
+            (when (> count 1)
+              (evil-repeat-find-char (1- count))
+              (unless find (forward-char)))
+          (when (or find fwd (/= char (char-before)) (> count 1))
+            (when (or find (and fwd (/= char (char-after (1+ (point))))))
+              (evil-repeat-find-char count))
+            (when (and (not find) fwd) (forward-char))))
+        (when (and find fwd) (forward-char))
+        (setq evil-last-find
+              (list (if find #'evil-find-char #'evil-find-char-to) char fwd)))
+    (message "evil-repeat-find-char: No previous search")))
 
 (evil-define-motion evil-emacs-cursor-model-repeat-find-char-reverse (count)
   "Repeat the last find/to COUNT times in the opposite direction."
   :type inclusive
   (interactive "<c>")
   (unless count (setq count 1))
-  (let ((find (eq (car evil-last-find) #'evil-find-char))
-        (char (car (cdr evil-last-find)))
-        (forward (car (cdr (cdr evil-last-find)))))
-    (if (and (not forward)
-             (= char (char-after)))
-        (when (> count 1)
-          (evil-repeat-find-char-reverse (1- count))
-          (unless find (forward-char)))
-      (when (or find
-                (not forward)
-                (/= char (char-before))
-                (> count 1))
-        (when (or find (/= char (char-after (1+ (point)))))
-          (evil-repeat-find-char-reverse count))
-        (unless (or find forward) (forward-char))))
-    (unless (or (not find) forward) (forward-char))
-    (setq evil-last-find
-          (list (if find #'evil-find-char #'evil-find-char-to) char forward))))
+  (if evil-last-find
+      (let ((find (eq (car evil-last-find) #'evil-find-char))
+            (char (nth 1 evil-last-find))
+            (fwd (nth 2 evil-last-find)))
+        (if (and (not fwd) (= char (char-after)))
+            (when (> count 1)
+              (evil-repeat-find-char-reverse (1- count))
+              (unless find (forward-char)))
+          (when (or find (not fwd) (/= char (char-before)) (> count 1))
+            (when (or find (and (not fwd) (/= char (char-after (1+ (point))))))
+              (evil-repeat-find-char-reverse count))
+            (unless (or find fwd) (forward-char))))
+        (unless (or (not find) fwd) (forward-char))
+        (setq evil-last-find
+              (list (if find #'evil-find-char #'evil-find-char-to) char fwd)))
+    (message "evil-repeat-find-char: No previous search")))
 
 (defun evil-emacs-cursor-model-forward-after-end (thing &optional count)
   "Move forward to end of THING.

Reply via email to