From 4ea25cde176548865f431e4a60a08d46c42eb91f Mon Sep 17 00:00:00 2001 From: Rodrigo Kassick Date: Wed, 19 Jan 2022 09:04:08 -0300 Subject: [PATCH 1/2] fix: make {word,WORD}-end movements see past single letters in operator-state evilem-motion-forward-{word, WORD}-end does not collect all targets when called in operator-state due to a corner case in evil-forward-word-end: when called in operator-state, evil ensures the cursor does not move if it's over a one-letter word. As a result, evilem--collect repeated calls to forward-word-end in operator state will stop at the first single-letter word inside the line. For example, `g s e` will place targets on every word as expected: cursor | v this is a word ^ ^ ^ ^ | | | | a s d f But when calling evilem-motion-forward-word-end during yank/delete/change, no targets will be created after "a", as evilem--collect stops after evil-forward-word-end did not move the cursor in "a". For example, pressiong `y g s e` in the example below will not place any target at "word" or any text afterwards: cursor | v this is a word ^ ^ ^ | | | a s d This commit fixes this behaviour by temporarely setting evil-state to 'motion while collecting targets. --- evil-easymotion.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/evil-easymotion.el b/evil-easymotion.el index 9c17c25..20ad212 100644 --- a/evil-easymotion.el +++ b/evil-easymotion.el @@ -134,7 +134,8 @@ ;; make sure the motion doesn't move the window (scroll-conservatively 101) (smooth-scrolling-mode nil) - (scroll-margin 0)) + (scroll-margin 0) + (evil-state 'normal)) (if (functionp func) (avy-dowindows current-prefix-arg (save-excursion From 3309d37aaae5d718da1b69eeb4d02b8a6fa1b1ac Mon Sep 17 00:00:00 2001 From: Rodrigo Kassick Date: Wed, 19 Jan 2022 10:16:43 -0300 Subject: [PATCH 2/2] fix: call evilem--compute-inclusivity with the name of the function During the macro expantion of (evilem-make-motion evilem-motion-some #'evil-some-motion) the function quote argument becomes (funcion . (evil-some-motion . nil)) This list was being passed to evilem--compute-inclusivity , which would try to take the first element and try to fetch the :type property of the evil function effectively evil-get-command-property with the symbol 'function instead of 'evil-some-motion. This commit fixes this behaviour, keeping backwards compatibility in case someone anywhere called (evilem--compute-inclusivity '(evil-some-motion)) --- evil-easymotion.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/evil-easymotion.el b/evil-easymotion.el index 20ad212..a74353e 100644 --- a/evil-easymotion.el +++ b/evil-easymotion.el @@ -185,10 +185,12 @@ (eval-and-compile (defun evilem--compute-inclusivity (funcs) - (when (and (= (length funcs) 1) - (evil-has-command-properties-p (car funcs))) - `(setq evil-this-type - ',(evil-get-command-property (car funcs) :type))))) + (cond ((symbolp funcs) `(setq evil-this-type + ',(evil-get-command-property funcs :type))) + + ((and (listp funcs) (= (length funcs) 1)) (evilem--compute-inclusivity (car funcs))) + + ((and (listp funcs) (= (length funcs) 2) (eq (car funcs) 'function)) (evilem--compute-inclusivity (cdr funcs)))))) (cl-defmacro evilem-make-motion (name funcs