shell layer: enable by default shell-protect-eshell-prompt

This commit is contained in:
syl20bnr 2015-07-26 02:41:26 -04:00
parent 829e4eb7ee
commit 5ab157a427
3 changed files with 9 additions and 8 deletions

View File

@ -113,12 +113,13 @@ work sensibly. E.g. you can press ~cc~ in normal state i.e.
=evil-change-whole-line= to kill the current input and start typing a new
command. In Eshell you also kill the prompt, which is often unintended.
To enable a the same behavior as in Comint mode you can enable the following
variable:
By default this layer also protects the =ehsell= prompt. If you want to
disable this protection you can set the variable =shell-protect-eshell-prompt=
to nil.
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-configuration-layers
'(shell :variables shell-protect-eshell-prompt t))
'(shell :variables shell-protect-eshell-prompt nil))
#+END_SRC
* Eshell

View File

@ -33,7 +33,7 @@
"If non-nil then `em-smart' is enabled. `em-smart' allows to quickly review
commands, modify old commands or enter a new one.")
(defvar shell-protect-eshell-prompt nil
(defvar shell-protect-eshell-prompt t
"If non-nil then eshell's prompt is protected. This means that
that movement to the prompt is inhibited like for `comint-mode'
prompts and the prompt is made read-only")
movement to the prompt is inhibited like for `comint-mode'
prompts and the prompt is made read-only")

View File

@ -70,7 +70,7 @@ the user activate the completion manually."
(end-of-buffer)))
(when shell-protect-eshell-prompt
(defun protect-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
@ -84,7 +84,7 @@ is achieved by adding the relevant text properties."
field output
read-only t
front-sticky (field inhibit-line-move-field-capture)))))
(add-hook 'eshell-after-prompt-hook 'protect-eshell-prompt))
(add-hook 'eshell-after-prompt-hook 'spacemacs//protect-eshell-prompt))
(defun spacemacs//init-eshell ()
"Stuff to do when enabling eshell."