I'm using the following snippet from Spacemacs to prevent modification of the eshell prompt:
(defun spacemacs//protect-eshell-prompt ()
"Protect Eshell's prompt like Comint's prompts.
E.g. `evil-change-whole-line' won't wipe the prompt. This
is achieved by adding the relevant text properties."
(let ((inhibit-field-text-motion t))
(add-text-properties
(point-at-bol)
(point)
'(rear-nonsticky t
inhibit-line-move-field-capture t
field output
read-only t
front-sticky (field inhibit-line-move-field-capture)))))
However, as a result of the additional text properties, (beginning-of-line) in esh-autosuggest--prefix stops right after the prompt instead of at the beginning of the prompt. This causes the while loop to fail. Perhaps we can use something like (re-search-backward "^" nil 'noerror) instead?
As a side question, can we check if (eshell-bol) returns nil and then use the result of re-search-forward? Not really sure why we need (eshell-bol) here.
Thanks!
I'm using the following snippet from Spacemacs to prevent modification of the eshell prompt:
However, as a result of the additional text properties,
(beginning-of-line)in esh-autosuggest--prefix stops right after the prompt instead of at the beginning of the prompt. This causes the while loop to fail. Perhaps we can use something like(re-search-backward "^" nil 'noerror)instead?As a side question, can we check if
(eshell-bol)returns nil and then use the result ofre-search-forward? Not really sure why we need(eshell-bol)here.Thanks!