diff options
| author | Roland McGrath <roland@gnu.org> | 1993-09-08 07:39:14 +0000 |
|---|---|---|
| committer | Roland McGrath <roland@gnu.org> | 1993-09-08 07:39:14 +0000 |
| commit | 94f9dcbecf4918952ee5d6f5e5939c5161889e03 (patch) | |
| tree | 579c79a3901b810d1f8eaadbb9e36be234bb8cbf | |
| parent | 09567b5cb1dc77c7df6f6d4255d3dfac649b3b02 (diff) | |
| download | emacs-94f9dcbecf4918952ee5d6f5e5939c5161889e03.tar.gz | |
(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.el | 17 |
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." ;;; All the commands that mung the buffer's dirstack finish by calling ;;; this guy. (defun shell-dirstack-message () - (let ((msg "") - (ds (cons default-directory shell-dirstack))) + (let* ((msg "") + (ds (cons default-directory shell-dirstack)) + (home (expand-file-name (concat comint-filename-prefix "~/"))) + (homelen (length home))) (while ds (let ((dir (car ds))) - (if (string-match (format "^%s\\(/\\|$\\)" (getenv "HOME")) dir) - (setq dir (concat "~/" (substring dir (match-end 0))))) + (and (>= (length dir) homelen) (string= home (substring dir 0 homelen)) + (setq dir (concat "~/" (substring dir homelen)))) + ;; Strip off comint-filename-prefix if present. + (and comint-filename-prefix + (>= (length dir) (length comint-filename-prefix)) + (string= comint-filename-prefix + (substring dir 0 (length comint-filename-prefix))) + (setq dir (substring dir (length comint-filename-prefix))) + (setcar ds dir)) (if (string-equal dir "~/") (setq dir "~")) (setq msg (concat msg dir " ")) (setq ds (cdr ds)))) |
