In Evil mode, after I enter visual-state
, I can use f
to expand the selection by jumping to a character. Now if I've pressed f
after entering visual-state
, Emacs asks me to input a character to jump to, which I think is implemented using read-key-sequence
. What I want to do is to call some external process before I enter the character, so I advise the read-key-sequence
function(below is a simplified version):
(defun foo (orig-func &rest args)
(with-temp-buffer
(call-process "ls" nil t))
(apply orig-func args))
(advice-add 'read-key-sequence :around 'foo)
Now I enter the visual-state
, press f
, enter the character, jump to it, and nothing is shown selected, i.e., the region is not active.
However, if I just change the parameter of call-process
by setting the fourth argument(destination
) to be nil
, i.e., using the following version of foo
:
(defun foo (orig-func &rest args)
(with-temp-buffer
(call-process "ls"))
(apply orig-func args))
Everything works fine, exactly like without adding advice to read-key-sequence
.
My question is, is there something I did wrong, or something of call-process
and Evil implementation will magically change the state of the region?