Don't 'cd' as root when using 'sudo' from Tramp
* eat.el (eat--eshell-setup-proc-and-term): Don't set 'eat--eshell-invocation-directory'. * eat.el (eat--eshell-update-cwd): New function. * eat.el (eat--eshell-local-mode): Call 'eat--eshell-update-cwd' when enabling the mode and add it to 'eshell-directory-change-hook' to keep track of Eshell's working directory.
This commit is contained in:
parent
856d429f2d
commit
980265ac05
1 changed files with 9 additions and 2 deletions
11
eat.el
11
eat.el
|
@ -5342,8 +5342,7 @@ PROGRAM can be a shell command."
|
|||
(defun eat--eshell-setup-proc-and-term (proc)
|
||||
"Setup process PROC and a new terminal for it."
|
||||
(unless (or eat--terminal eat--process)
|
||||
(setq eat--process proc
|
||||
eat--eshell-invocation-directory default-directory)
|
||||
(setq eat--process proc)
|
||||
(process-put proc 'adjust-window-size-function
|
||||
#'eat--adjust-process-window-size)
|
||||
(setq eat--terminal (eat-term-make (current-buffer)
|
||||
|
@ -5523,6 +5522,10 @@ sane 2>%s ; if [ $1 = .. ]; then shift; fi; exec \"$@\""
|
|||
(point)))))))
|
||||
(goto-char (eat-term-display-cursor eat--terminal)))
|
||||
|
||||
(defun eat--eshell-update-cwd ()
|
||||
"Update the current working directory."
|
||||
(setq eat--eshell-invocation-directory default-directory))
|
||||
|
||||
(define-minor-mode eat--eshell-local-mode
|
||||
"Toggle Eat terminal emulation is Eshell."
|
||||
:interactive nil
|
||||
|
@ -5640,6 +5643,8 @@ sane 2>%s ; if [ $1 = .. ]; then shift; fi; exec \"$@\""
|
|||
(with-current-buffer buffer
|
||||
(eat--eshell-local-mode +1))))
|
||||
(add-hook 'eshell-mode-hook #'eat--eshell-local-mode)
|
||||
(add-hook 'eshell-directory-change-hook #'eat--eshell-update-cwd)
|
||||
(eat--eshell-update-cwd)
|
||||
(setq eshell-variable-aliases-list
|
||||
`(("TERM" eat--eshell-term-name t)
|
||||
("TERMINFO" eat-term-terminfo-directory t)
|
||||
|
@ -5668,6 +5673,8 @@ sane 2>%s ; if [ $1 = .. ]; then shift; fi; exec \"$@\""
|
|||
(with-current-buffer buffer
|
||||
(eat--eshell-local-mode -1))))
|
||||
(remove-hook 'eshell-mode-hook #'eat--eshell-local-mode)
|
||||
(remove-hook 'eshell-directory-change-hook
|
||||
#'eat--eshell-update-cwd)
|
||||
(setq eshell-variable-aliases-list
|
||||
(cl-delete-if
|
||||
(lambda (elem)
|
||||
|
|
Loading…
Add table
Reference in a new issue