Why does this not work the first time it's called?

Guido Van Hoecke guivho at gmail.com
Sun Jan 27 18:45:03 CET 2013


I have a file that I want to visit, go to the second character of the
fourth word, and enter replace mode:

(defun guivho-test(name-of-file)
  "Visit file, goto fourth word, second char and enter replace mode"
  (interactive "fName of file: ")
  (find-file name-of-file)
  (beginning-of-line)
  (evil-forward-WORD-begin 3)
  (evil-forward-char)
  (evil-replace-state))

Test-file contents:

line1 word1 word2 word3
line2 word1 word2 word3
line3 word1 word2 word3
line4 word1 word2 word3

I do not understand why the last the evil-forward-char and the
evil-replace-state do not work when the file is not yet loaded, but do
work if the guivho-test is executed from the buffer that already has the
file. The first run leaves the cursor on the begin of the fourth word,
ans it remains in normal mode; executing it again does advance the extra
character and switches to replace mode.

Can somebody explain this?

TIA,


Guido

--
Under a government which imprisons any unjustly, the true place for a
just man is also in prison.
		-- Henry David Thoreau

http://vanhoecke.org ... and go2 places!



More information about the implementations-list mailing list