My Emacs version is 24.5.1.
Comint-mode protects the prompt by somehow defining the beginning of line to start directly after the prompt regex. This works for normal motion commands like move-beginning-of-line
and even evil-mode motions. For example I can kill the current input by calling evil-change-whole-line
and leave the prompt on the same line intact.
Eshell-mode isn't derived from comint mode, and the C-a
shortcut is overriden to eshell-bol, which takes the prompt into consideration. So by using normal Emacs shortcuts most things work, but trying to use the standard commands for movement like move-beginning-of-line
yields unexpected results. So by using evil-change-whole-line
I kill the whole line, when I only wanted to kill the input.
How does comint-mode protect the prompt and is it possible to implement the same behavior in eshell-mode?
Things I have tried but didn't bear fruit:
comint-line-beginning-position
andcomint-bol
are defined in comint.el, but they aren't called when callingevil-change-whole-line
ormove-beginning-of-line
.- I noticed some references to the
inhibit-field-text-motion
variable in comint.el. But it isnil
in at leastshell-mode
, which is comint-derived.