Programmatically call evil-find-char

Frank Fischer frank-fischer at
Sat Jan 17 21:24:52 CET 2015

Am 17.01.2015 um 07:04 schrieb Sylvain Benner:
> Hi,
> I'm trying to call interactively from the code the function
> `evil-find-char` while in visual state like this:
>     (call-interactively 'evil-find-char)
> A simplistic use case will be the following simple wrapper function mapped
> on `f` key:
>    (defun my-wrapper () (interactive) (call-interactively 'evil-find-char))
> The observed behavior is that when I press on `f` the point is put of the
> next character with no selection, then when I press a second key then the
> selection does not include the second character (like if I pressed `t` in
> regular Vim).

The problem is that Evil considers `my-wrapper` as regular Emacs
command. When called in visual state Evil adjusts point and mark so that
the region corresponds to the visual selection right before the command
is executed (and because Emacs region exclusive, point is moved to the
next character).

You could try to register `my-wrapper` as a regular Evil motion, i.e.

  (evil-define-motion my-wrapper (count)
    (call-interactively 'evil-find-char))

should work.


More information about the implementations-list mailing list