Commit 94f9dcbe authored by Roland McGrath's avatar Roland McGrath
Browse files

(shell-dirstack-message): Recognize ~ by matching the expansion of "~" with

comint-filename-prefix prepended.  Strip comint-filename-prefix from elts.
parent 09567b5c
...@@ -522,12 +522,21 @@ command again." ...@@ -522,12 +522,21 @@ command again."
;;; All the commands that mung the buffer's dirstack finish by calling ;;; All the commands that mung the buffer's dirstack finish by calling
;;; this guy. ;;; this guy.
(defun shell-dirstack-message () (defun shell-dirstack-message ()
(let ((msg "") (let* ((msg "")
(ds (cons default-directory shell-dirstack))) (ds (cons default-directory shell-dirstack))
(home (expand-file-name (concat comint-filename-prefix "~/")))
(homelen (length home)))
(while ds (while ds
(let ((dir (car ds))) (let ((dir (car ds)))
(if (string-match (format "^%s\\(/\\|$\\)" (getenv "HOME")) dir) (and (>= (length dir) homelen) (string= home (substring dir 0 homelen))
(setq dir (concat "~/" (substring dir (match-end 0))))) (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 "~")) (if (string-equal dir "~/") (setq dir "~"))
(setq msg (concat msg dir " ")) (setq msg (concat msg dir " "))
(setq ds (cdr ds)))) (setq ds (cdr ds))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment