You can clear the bindings for the cursor keys in
eshell-mode with the following Elisp snippet in your init file.
(defun my-eshell-config ()
"My Eshell configuration."
(define-key eshell-mode-map (kbd "<up>") nil)
(define-key eshell-mode-map (kbd "<down>") nil))
(add-hook 'eshell-mode-hook #'my-eshell-config)
Only the prompt echoes are read-only in
eshell-mode. All other output of Eshell and your input are editable.
You should never change the prompt echoes -- especially not the last one -- since they are regexp-matched by eshell.
See the doc-string of
A regexp which fully matches your eshell prompt.
This setting is important, since it affects how eshell will interpret
the lines that are passed to it.
If this variable is changed, all Eshell buffers must be exited and
re-entered for it to take effect.
If you occasionally want to modify a prompt echo in spite of good advice, you can use the following command to remove the read-only property from the prompt:
(defun remove-text-properties-interactive (&optional beg end ignore-read-only)
"Remove text properties in region from BEG to END.
The read-only text property within that region is ignored
if IGNORE-READ-ONLY is non-nil."
(let ((inhibit-read-only (if ignore-read-only t inhibit-read-only)))
(set-text-properties beg end nil))))
Since library developers almost always have their good reason to set the
read-only text property on stretches of buffer text the removal of the
read-only text property must be enforced by the prefix argument C-u.
The steps in detail:
- Mark the region with the Eshell prompt you want to modify.
- Call C-u M-x
remove-text-properties-interactive. (Note that the long command name does not hurt very much because of the available tab-completion in the minibuffer.)
- Do your modifications on the prompt string.