X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=lisp%2Ffiles.el;h=2480c799b83f50d3bbd12cb3057f77a12734a8f0;hp=fd4585a178bad863b587a2fb2dcfe79b3a587673;hb=d3dd71489ab2730d79536ebdc3c56cca82766e9d;hpb=c6a795ec5cc5151bdad2935828f12a0970e950d2 diff --git a/lisp/files.el b/lisp/files.el index fd4585a..2480c79 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -788,37 +788,36 @@ If optional argument HACK-HOMEDIR is non-nil, then this also substitutes ;; If any elt of directory-abbrev-alist matches this name, ;; abbreviate accordingly. (while tail - (if (string-match (car (car tail)) filename) - (setq filename - (concat (cdr (car tail)) (substring filename (match-end 0))))) + (when (string-match (car (car tail)) filename) + (setq filename + (concat (cdr (car tail)) (substring filename (match-end 0))))) (setq tail (cdr tail)))) - (if hack-homedir - (progn - ;; Compute and save the abbreviated homedir name. - ;; We defer computing this until the first time it's needed, to - ;; give time for directory-abbrev-alist to be set properly. - ;; We include a slash at the end, to avoid spurious matches - ;; such as `/usr/foobar' when the home dir is `/usr/foo'. - (or abbreviated-home-dir - (setq abbreviated-home-dir - (let ((abbreviated-home-dir "$foo")) - (concat "\\`" (regexp-quote (abbreviate-file-name - (expand-file-name "~"))) - "\\(/\\|\\'\\)")))) - ;; If FILENAME starts with the abbreviated homedir, - ;; make it start with `~' instead. - (if (and (string-match abbreviated-home-dir filename) - ;; If the home dir is just /, don't change it. - (not (and (= (match-end 0) 1) ;#### unix-specific - (= (aref filename 0) ?/))) - (not (and (memq system-type '(ms-dos windows-nt)) - (save-match-data - (string-match "^[a-zA-Z]:/$" filename))))) - (setq filename - (concat "~" - (substring filename - (match-beginning 1) (match-end 1)) - (substring filename (match-end 0))))))) + (when hack-homedir + ;; Compute and save the abbreviated homedir name. + ;; We defer computing this until the first time it's needed, to + ;; give time for directory-abbrev-alist to be set properly. + ;; We include a slash at the end, to avoid spurious matches + ;; such as `/usr/foobar' when the home dir is `/usr/foo'. + (or abbreviated-home-dir + (setq abbreviated-home-dir + (let ((abbreviated-home-dir "$foo")) + (concat "\\`" (regexp-quote (abbreviate-file-name + (expand-file-name "~"))) + "\\(/\\|\\'\\)")))) + ;; If FILENAME starts with the abbreviated homedir, + ;; make it start with `~' instead. + (if (and (string-match abbreviated-home-dir filename) + ;; If the home dir is just /, don't change it. + (not (and (= (match-end 0) 1) ;#### unix-specific + (= (aref filename 0) ?/))) + (not (and (memq system-type '(ms-dos windows-nt)) + (save-match-data + (string-match "^[a-zA-Z]:/$" filename))))) + (setq filename + (concat "~" + (substring filename + (match-beginning 1) (match-end 1)) + (substring filename (match-end 0)))))) filename))) (defcustom find-file-not-true-dirname-list nil @@ -1131,7 +1130,7 @@ run `normal-mode' explicitly." (defvar auto-mode-alist '(("\\.te?xt\\'" . text-mode) - ("\\.[ch]\\'" . c-mode) + ("\\.[chi]\\'" . c-mode) ("\\.el\\'" . emacs-lisp-mode) ("\\.\\(?:[CH]\\|cc\\|hh\\)\\'" . c++-mode) ("\\.[ch]\\(pp\\|xx\\|\\+\\+\\)\\'" . c++-mode)