reddit / emacs

Why does evil create new functions instead of making key bindings for those already existing?

LowCom · 2022-04-29 11:37
I looked up the function for the keystroke C-p and it is "previous-line". And the function for the evil key "k" is "evil-previous-visual-line". Why to make functions for the stuff already available? why not make your keybindings attach to existing functions?
wasamasa · 2022-04-29 12:29
Because Evil implements Vim and the movement command in Vim behaves slightly different from the one in Emacs: ;; The purpose of this function is to provide line motions which ;; preserve the column. This is how `previous-line' and `next-line' ;; work, but unfortunately the behaviour is hard-coded: if and only if ;; the last command was `previous-line' or `next-line', the column is ;; preserved. Furthermore, in contrast to Vim, when we cannot go ;; further, those motions move point to the beginning resp. the end of ;; the line (we never want point to leave its column). The code here ;; comes from simple.el, and I hope it will work in future.