comparison lisp/files.el @ 394:7d59cb494b73 r21-2-12

Import from CVS: tag r21-2-12
author cvs
date Mon, 13 Aug 2007 11:11:37 +0200
parents 8626e4521993
children 74fd4e045ea6
comparison
equal deleted inserted replaced
393:2e030b8965b1 394:7d59cb494b73
786 ;; (setq filename (substring filename (1- (match-end 0))))) 786 ;; (setq filename (substring filename (1- (match-end 0)))))
787 (let ((tail directory-abbrev-alist)) 787 (let ((tail directory-abbrev-alist))
788 ;; If any elt of directory-abbrev-alist matches this name, 788 ;; If any elt of directory-abbrev-alist matches this name,
789 ;; abbreviate accordingly. 789 ;; abbreviate accordingly.
790 (while tail 790 (while tail
791 (if (string-match (car (car tail)) filename) 791 (when (string-match (car (car tail)) filename)
792 (setq filename 792 (setq filename
793 (concat (cdr (car tail)) (substring filename (match-end 0))))) 793 (concat (cdr (car tail)) (substring filename (match-end 0)))))
794 (setq tail (cdr tail)))) 794 (setq tail (cdr tail))))
795 (if hack-homedir 795 (when hack-homedir
796 (progn 796 ;; Compute and save the abbreviated homedir name.
797 ;; Compute and save the abbreviated homedir name. 797 ;; We defer computing this until the first time it's needed, to
798 ;; We defer computing this until the first time it's needed, to 798 ;; give time for directory-abbrev-alist to be set properly.
799 ;; give time for directory-abbrev-alist to be set properly. 799 ;; We include a slash at the end, to avoid spurious matches
800 ;; We include a slash at the end, to avoid spurious matches 800 ;; such as `/usr/foobar' when the home dir is `/usr/foo'.
801 ;; such as `/usr/foobar' when the home dir is `/usr/foo'. 801 (or abbreviated-home-dir
802 (or abbreviated-home-dir 802 (setq abbreviated-home-dir
803 (setq abbreviated-home-dir 803 (let ((abbreviated-home-dir "$foo"))
804 (let ((abbreviated-home-dir "$foo")) 804 (concat "\\`" (regexp-quote (abbreviate-file-name
805 (concat "\\`" (regexp-quote (abbreviate-file-name 805 (expand-file-name "~")))
806 (expand-file-name "~"))) 806 "\\(/\\|\\'\\)"))))
807 "\\(/\\|\\'\\)")))) 807 ;; If FILENAME starts with the abbreviated homedir,
808 ;; If FILENAME starts with the abbreviated homedir, 808 ;; make it start with `~' instead.
809 ;; make it start with `~' instead. 809 (if (and (string-match abbreviated-home-dir filename)
810 (if (and (string-match abbreviated-home-dir filename) 810 ;; If the home dir is just /, don't change it.
811 ;; If the home dir is just /, don't change it. 811 (not (and (= (match-end 0) 1) ;#### unix-specific
812 (not (and (= (match-end 0) 1) ;#### unix-specific 812 (= (aref filename 0) ?/)))
813 (= (aref filename 0) ?/))) 813 (not (and (memq system-type '(ms-dos windows-nt))
814 (not (and (memq system-type '(ms-dos windows-nt)) 814 (save-match-data
815 (save-match-data 815 (string-match "^[a-zA-Z]:/$" filename)))))
816 (string-match "^[a-zA-Z]:/$" filename))))) 816 (setq filename
817 (setq filename 817 (concat "~"
818 (concat "~" 818 (substring filename
819 (substring filename 819 (match-beginning 1) (match-end 1))
820 (match-beginning 1) (match-end 1)) 820 (substring filename (match-end 0))))))
821 (substring filename (match-end 0)))))))
822 filename))) 821 filename)))
823 822
824 (defcustom find-file-not-true-dirname-list nil 823 (defcustom find-file-not-true-dirname-list nil
825 "*List of logical names for which visiting shouldn't save the true dirname." 824 "*List of logical names for which visiting shouldn't save the true dirname."
826 :type '(repeat (string :tag "Name")) 825 :type '(repeat (string :tag "Name"))
1129 ;; `default-auto-mode-alist') for default stuff, such as some of the 1128 ;; `default-auto-mode-alist') for default stuff, such as some of the
1130 ;; entries below. 1129 ;; entries below.
1131 1130
1132 (defvar auto-mode-alist 1131 (defvar auto-mode-alist
1133 '(("\\.te?xt\\'" . text-mode) 1132 '(("\\.te?xt\\'" . text-mode)
1134 ("\\.[ch]\\'" . c-mode) 1133 ("\\.[chi]\\'" . c-mode)
1135 ("\\.el\\'" . emacs-lisp-mode) 1134 ("\\.el\\'" . emacs-lisp-mode)
1136 ("\\.\\(?:[CH]\\|cc\\|hh\\)\\'" . c++-mode) 1135 ("\\.\\(?:[CH]\\|cc\\|hh\\)\\'" . c++-mode)
1137 ("\\.[ch]\\(pp\\|xx\\|\\+\\+\\)\\'" . c++-mode) 1136 ("\\.[ch]\\(pp\\|xx\\|\\+\\+\\)\\'" . c++-mode)
1138 ("\\.java\\'" . java-mode) 1137 ("\\.java\\'" . java-mode)
1139 ("\\.idl\\'" . idl-mode) 1138 ("\\.idl\\'" . idl-mode)