Don't remove trailing slash in Eshell "pwd" for remote root directories

* lisp/eshell/em-dirs.el (eshell/pwd): Check if 'file-local-name' of the
directory is the root dir.
This commit is contained in:
Jim Porter 2024-10-31 10:37:24 -07:00
parent 9fe7b8ca41
commit 33997047e8

View file

@ -319,14 +319,13 @@ Thus, this does not include the current directory.")
(defun eshell/pwd ()
"Change output from `pwd' to be cleaner."
(let* ((path default-directory)
(len (length path)))
(if (and (> len 1)
(eq (aref path (1- len)) ?/)
(not (and (eshell-under-windows-p)
(string-match "\\`[A-Za-z]:[\\/]\\'" path))))
(setq path (substring path 0 (1- (length path)))))
(funcall (or eshell-pwd-convert-function #'identity) path)))
(let ((dir default-directory))
(when (and (eq (aref dir (1- (length dir))) ?/)
(not (and (eshell-under-windows-p)
(string-match "\\`[A-Za-z]:[\\/]\\'" dir)))
(length> (file-local-name dir) 1))
(setq dir (substring dir 0 -1)))
(funcall (or eshell-pwd-convert-function #'identity) dir)))
(defun eshell-expand-multiple-dots (filename)
;; FIXME: This advice recommendation is rather odd: it's somewhat