Skip to content

Commit

Permalink
Use avy-with in motion definitions, closes #37
Browse files Browse the repository at this point in the history
  • Loading branch information
PythonNut committed Oct 18, 2016
1 parent eb1433a commit 72129a6
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions evil-easymotion.el
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,21 @@
'evil-define-command
'evil-define-motion)
,name (&optional _count)
(evil-without-repeat
(setq evil-this-type 'inclusive)
(cl-letf* ,bind
,(when pre-hook `(funcall ,(if (functionp pre-hook)
pre-hook
`(lambda () ,pre-hook))))
(evilem--jump (evilem--collect ,funcs
,scope
,all-windows
,initial-point
,collect-postprocess))
,(when post-hook `(funcall ,(if (functionp post-hook)
post-hook
`(lambda () ,post-hook))))))))
(avy-with ,name
(evil-without-repeat
(setq evil-this-type 'inclusive)
(cl-letf* ,bind
,(when pre-hook `(funcall ,(if (functionp pre-hook)
pre-hook
`(lambda () ,pre-hook))))
(evilem--jump (evilem--collect ,funcs
,scope
,all-windows
,initial-point
,collect-postprocess))
,(when post-hook `(funcall ,(if (functionp post-hook)
post-hook
`(lambda () ,post-hook)))))))))

(cl-defmacro evilem-make-motion-plain (name
funcs
Expand All @@ -207,18 +208,19 @@
"Automatically define a plain easymotion for `func', naming it `name'"
`(defun ,name ()
(interactive)
(cl-letf* ,bind
,(when pre-hook `(funcall ,(if (functionp pre-hook)
pre-hook
`(lambda () ,pre-hook))))
(evilem--jump (evilem--collect ,funcs
,scope
,all-windows
,initial-point
,collect-postprocess))
,(when post-hook `(funcall ,(if (functionp post-hook)
post-hook
`(lambda () ,post-hook)))))))
(avy-with ,name
(cl-letf* ,bind
,(when pre-hook `(funcall ,(if (functionp pre-hook)
pre-hook
`(lambda () ,pre-hook))))
(evilem--jump (evilem--collect ,funcs
,scope
,all-windows
,initial-point
,collect-postprocess))
,(when post-hook `(funcall ,(if (functionp post-hook)
post-hook
`(lambda () ,post-hook))))))))

(cl-defmacro evilem-create (motions
&key
Expand Down

0 comments on commit 72129a6

Please sign in to comment.