Opening a new line in evil-mode

Gordon Gustafson gordon3.14 at gmail.com
Mon Jun 2 16:52:07 CEST 2014


Evil does its best to ensure that the point can neven be at the end of
the line *in normal state*. However, other elisp commands can still
move the point wherever they like, so if you wrap both of those
commands in a function foo, calling foo will exhibit the typical emacs
behavior since evil can't get a word in edgewise (the last symbol is
not carried to the next line). Notice that if you run those commands
one after another with M-:, evil restores its invariant in between,
and you DO get the next last symbol carried to the next line.

On 6/2/14, Dima Gorbik <dmitry at gorbik.ru> wrote:
> Hello all,
>
> Please take a look at the following piece of code:
>
> (goto-char (point-max))
> (insert "\n")
>
> In normal state of evil-mode goto-char moves the cursor to the end of line
> visually, but it points before the last symbol, not after. Although the
> example above works just fine -- it works as if the cursor is pointing after
> the last symbol so the last symbol is not carried to the next line which is
> a correct behavior. I wonder how evil determines that it needs to insert
> after the last symbol, not before.
>
> The reason I ask about this is because I am trying to understand why hitting
> enter in haskell-mode repl in normal state in evil-mode puts the last symbol
> of the current line on the next line. It looks like (insert "\n") is invoked
> in a callback and evil doesn't know that it needs to maintain the
> compatibility.
>
> Thanks,
> Dima
> _______________________________________________
> implementations-list mailing list
> implementations-list at lists.ourproject.org
> https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list
>



More information about the implementations-list mailing list