Why does this not work the first time it's called?
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!
On 2013-01-27, Guido Van Hoecke <[email protected]> wrote:
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.
I can't reproduce that, in all my tests everything works as expected. Which evil version and Emacs version do you use? What happens if you test with "make emacs" from evil's source? Best regards, Frank
Hi Frank, Thanks for your reply. On 27 January 2013 19:46, Frank Fischer <[email protected]> wrote:
On 2013-01-27, Guido Van Hoecke <[email protected]> wrote:
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.
I can't reproduce that, in all my tests everything works as expected. Which evil version and Emacs version do you use? What
GNU Emacs 24.2.1 (x86_64-apple-darwin, NS apple-appkit-1038.36) of 2012-08-27 on bob.porkrind.org org-version 7.9.1
happens if you test with "make emacs" from evil's source?
Never done that yet, I'll report the outcome when done. Kind regards, Guido -- Oh this age! How tasteless and ill-bred it is. -- Gaius Valerius Catullus http://vanhoecke.org ... and go2 places!
Hi Frank, On 27 January 2013 19:46, Frank Fischer <[email protected]> wrote:
On 2013-01-27, Guido Van Hoecke <[email protected]> wrote:
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.
I can't reproduce that, in all my tests everything works as expected. Which evil version and Emacs version do you use? What
$ emacs-version GNU Emacs 24.2.1 (x86_64-apple-darwin, NS apple-appkit-1038.36) of 2012-08-27 on bob.porkrind.org $ evil-version Evil version 0.1
happens if you test with "make emacs" from evil's source?
I just pulled in the current source and the behaviour is not changed: works the second time (from the file's buffer), not the first time Let me use this opportunity to praise evil. This is a terrific implementation of the vim paradigm and truly unites the best of the two best editors in the world. I particularly admire the seamless integration, it is indeed way better than any previous vi emulations I've been through before. Kind regards, Guido (P.S. Sorry about the org-version mixup in my previous reply) -- They are cold-blooded. They are completely ruthless about protecting what they have. The only thing they connect to is the money aspect of life. Let's face it: That's the American way. -- Jeffery M. Johnson, regional chairman of the District of Columbia United Way, speaking of drug dealers. http://vanhoecke.org ... and go2 places!
Hi Frank, It works! It took a 'make all' followed by a cold restart of Emacs. Now it works from the first run. Thanks for your help, and for evil! Guido On 28 January 2013 08:53, Guido Van Hoecke <[email protected]> wrote:
Hi Frank,
On 27 January 2013 19:46, Frank Fischer <[email protected]> wrote:
On 2013-01-27, Guido Van Hoecke <[email protected]> wrote:
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.
I can't reproduce that, in all my tests everything works as expected. Which evil version and Emacs version do you use? What
$ emacs-version GNU Emacs 24.2.1 (x86_64-apple-darwin, NS apple-appkit-1038.36) of 2012-08-27 on bob.porkrind.org
$ evil-version Evil version 0.1
happens if you test with "make emacs" from evil's source?
I just pulled in the current source and the behaviour is not changed: works the second time (from the file's buffer), not the first time
Let me use this opportunity to praise evil. This is a terrific implementation of the vim paradigm and truly unites the best of the two best editors in the world. I particularly admire the seamless integration, it is indeed way better than any previous vi emulations I've been through before.
Kind regards,
Guido
(P.S. Sorry about the org-version mixup in my previous reply)
-- They are cold-blooded. They are completely ruthless about protecting what they have. The only thing they connect to is the money aspect of life. Let's face it: That's the American way. -- Jeffery M. Johnson, regional chairman of the District of Columbia United Way, speaking of drug dealers.
http://vanhoecke.org ... and go2 places!
participants (2)
-
Frank Fischer -
Guido Van Hoecke