diff 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
line wrap: on
line diff
--- a/lisp/files.el	Mon Aug 13 11:10:52 2007 +0200
+++ b/lisp/files.el	Mon Aug 13 11:11:37 2007 +0200
@@ -788,37 +788,36 @@
 	;; 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 @@
 
 (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)