[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/eat 980265ac05 1/3: Don't 'cd' as root when using 'sudo' f
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/eat 980265ac05 1/3: Don't 'cd' as root when using 'sudo' from Tramp |
Date: |
Thu, 8 Dec 2022 09:58:41 -0500 (EST) |
branch: elpa/eat
commit 980265ac05be9e346709912ace8c7a0e30bc5efc
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>
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.
---
eat.el | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/eat.el b/eat.el
index 65a1067119..56ebdcb32e 100644
--- a/eat.el
+++ b/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)