(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