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). For the complete story, I'm replacing the map of `evil-find-char` on `f` in order to be able to `escape` to normal state by quickly pressing `fd`. This is currently implemented in package `evil-escape` with key-chord which I want to drop because of several edge cases with Evil. This `fd` as `ESC` is mainly used in spacemacs which is an Evil focused Emacs kit. Cheers, -syl20bnr-
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. Frank
Thank you Frank, works like a charm, `evil-escape` does not depend on `key-chord` anymore. -syl20bnr- On Sat, Jan 17, 2015 at 3:24 PM, Frank Fischer <[email protected]
wrote:
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.
Frank
_______________________________________________ implementations-list mailing list [email protected] https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list
participants (2)
-
Frank Fischer -
Sylvain Benner