aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland McGrath1993-09-08 07:39:14 +0000
committerRoland McGrath1993-09-08 07:39:14 +0000
commit94f9dcbecf4918952ee5d6f5e5939c5161889e03 (patch)
tree579c79a3901b810d1f8eaadbb9e36be234bb8cbf
parent09567b5cb1dc77c7df6f6d4255d3dfac649b3b02 (diff)
downloademacs-94f9dcbecf4918952ee5d6f5e5939c5161889e03.tar.gz
emacs-94f9dcbecf4918952ee5d6f5e5939c5161889e03.zip
(shell-dirstack-message): Recognize ~ by matching the expansion of "~" with
comint-filename-prefix prepended. Strip comint-filename-prefix from elts.
-rw-r--r--lisp/shell.el17
1 files changed, 13 insertions, 4 deletions
diff --git a/lisp/shell.el b/lisp/shell.el
index 530ea4478ac..27f16685a1b 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -522,12 +522,21 @@ command again."
522;;; All the commands that mung the buffer's dirstack finish by calling 522;;; All the commands that mung the buffer's dirstack finish by calling
523;;; this guy. 523;;; this guy.
524(defun shell-dirstack-message () 524(defun shell-dirstack-message ()
525 (let ((msg "") 525 (let* ((msg "")
526 (ds (cons default-directory shell-dirstack))) 526 (ds (cons default-directory shell-dirstack))
527 (home (expand-file-name (concat comint-filename-prefix "~/")))
528 (homelen (length home)))
527 (while ds 529 (while ds
528 (let ((dir (car ds))) 530 (let ((dir (car ds)))
529 (if (string-match (format "^%s\\(/\\|$\\)" (getenv "HOME")) dir) 531 (and (>= (length dir) homelen) (string= home (substring dir 0 homelen))
530 (setq dir (concat "~/" (substring dir (match-end 0))))) 532 (setq dir (concat "~/" (substring dir homelen))))
533 ;; Strip off comint-filename-prefix if present.
534 (and comint-filename-prefix
535 (>= (length dir) (length comint-filename-prefix))
536 (string= comint-filename-prefix
537 (substring dir 0 (length comint-filename-prefix)))
538 (setq dir (substring dir (length comint-filename-prefix)))
539 (setcar ds dir))
531 (if (string-equal dir "~/") (setq dir "~")) 540 (if (string-equal dir "~/") (setq dir "~"))
532 (setq msg (concat msg dir " ")) 541 (setq msg (concat msg dir " "))
533 (setq ds (cdr ds)))) 542 (setq ds (cdr ds))))