# HG changeset patch # User Roland McGrath # Date 747473954 0 # Node ID ed9240986f40af0c937f5a4fc7bffee9bb144d91 # Parent cd842296bebf5c35d2ec0e3d964f6003add4e134 (shell-dirstack-message): Recognize ~ by matching the expansion of "~" with comint-filename-prefix prepended. Strip comint-filename-prefix from elts. diff -r cd842296bebf -r ed9240986f40 lisp/shell.el --- a/lisp/shell.el Wed Sep 08 07:09:00 1993 +0000 +++ b/lisp/shell.el Wed Sep 08 07:39:14 1993 +0000 @@ -522,12 +522,21 @@ ;;; 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))))