emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 33997047e89: Don't remove trailing slash in Eshell "pwd" for remo


From: Jim Porter
Subject: master 33997047e89: Don't remove trailing slash in Eshell "pwd" for remote root directories
Date: Thu, 31 Oct 2024 13:38:31 -0400 (EDT)

branch: master
commit 33997047e891d5513c4f33ab78ad353746ed16e2
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Jim Porter <jporterbugs@gmail.com>

    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.
---
 lisp/eshell/em-dirs.el | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el
index 9cf0994fe78..ad0a5beac1e 100644
--- a/lisp/eshell/em-dirs.el
+++ b/lisp/eshell/em-dirs.el
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]