XEmacs 21.2.12
[chise/xemacs-chise.git.1] / lisp / files.el
index fd4585a..2480c79 100644 (file)
@@ -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)