Mercurial > emacs
comparison lisp/shell.el @ 4679:ed9240986f40
(shell-dirstack-message): Recognize ~ by matching the expansion of "~" with
comint-filename-prefix prepended. Strip comint-filename-prefix from elts.
author | Roland McGrath <roland@gnu.org> |
---|---|
date | Wed, 08 Sep 1993 07:39:14 +0000 |
parents | 835ecfabae68 |
children | 30a614eb52f7 |
comparison
equal
deleted
inserted
replaced
4678:cd842296bebf | 4679:ed9240986f40 |
---|---|
520 ;;; Pretty up dirs a bit by changing "/usr/jqr/foo" to "~/foo". | 520 ;;; Pretty up dirs a bit by changing "/usr/jqr/foo" to "~/foo". |
521 ;;; (This isn't necessary if the dirlisting is generated with a simple "dirs".) | 521 ;;; (This isn't necessary if the dirlisting is generated with a simple "dirs".) |
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)))) |
534 (message msg))) | 543 (message msg))) |
535 | 544 |