changeset 13903:936c8364e15a

(abbrev-file-name): Drive letter can go beyond `Z' under MS-DOS/Novell. (auto-mode-alist): Support txt and txi like text and texi. (backup-buffer): Use convert-standard-filename. (basic-save-buffer-1): Make the name of the temporary file (where precious files are saved) conform to MS-DOS 8+3 constraints. (convert-standard-filename): New function.
author Richard M. Stallman <rms@gnu.org>
date Mon, 01 Jan 1996 22:51:51 +0000
parents 31e37f3d8ccd
children d9bf85b9c19e
files lisp/files.el
diffstat 1 files changed, 22 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Sun Dec 31 19:49:39 1995 +0000
+++ b/lisp/files.el	Mon Jan 01 22:51:51 1996 +0000
@@ -252,6 +252,13 @@
 		      inhibit-file-name-handlers)))
 	  (inhibit-file-name-operation op))
       (apply op args))))
+
+(defun convert-standard-filename (filename)
+  "Convert a standard file's name to something suitable for the current OS.
+This function's standard definition is trivial; it just returns the argument.
+However, on some systems, the function is redefined
+with a definition that really does change some file names."
+  filename)
 
 (defun pwd ()
   "Show the current default directory."
@@ -630,10 +637,12 @@
 	     ;; If the home dir is just /, don't change it.
 	     (not (and (= (match-end 0) 1)
 		       (= (aref filename 0) ?/)))
+	     ;; MS-DOS root directories can come with a drive letter;
+	     ;; Novell Netware allows drive letters beyond `Z:'.
 	     (not (and (or (eq system-type 'ms-dos)
 			   (eq system-type 'windows-nt))
 		       (save-match-data
-			 (string-match "^[a-zA-Z]:/$" filename)))))
+			 (string-match "^[a-zA-`]:/$" filename)))))
 	(setq filename
 	      (concat "~"
 		      (substring filename (match-beginning 1) (match-end 1))
@@ -886,7 +895,7 @@
 		    (prin1-to-string err)))))
 
 (defvar auto-mode-alist
-  '(("\\.text\\'" . text-mode)
+  '(("\\.te?xt\\'" . text-mode)
     ("\\.c\\'" . c-mode)
     ("\\.h\\'" . c-mode)
     ("\\.tex\\'" . tex-mode)
@@ -921,7 +930,7 @@
 ;;; Less common extensions come here
 ;;; so more common ones above are found faster.
     ("\\.texinfo\\'" . texinfo-mode)
-    ("\\.texi\\'" . texinfo-mode)
+    ("\\.te?xi\\'" . texinfo-mode)
     ("\\.s\\'" . asm-mode)
     ("\\.S\\'" . asm-mode)
     ("\\.asm\\'" . asm-mode)
@@ -1521,8 +1530,11 @@
 			(setq setmodes (file-modes backupname)))
 		    (file-error
 		     ;; If trouble writing the backup, write it in ~.
-		     (setq backupname (expand-file-name "~/%backup%~"))
-		     (message "Cannot write backup file; backing up in ~/%%backup%%~")
+		     (setq backupname (expand-file-name
+				       (convert-standard-filename
+					"~/%backup%~")))
+		     (message "Cannot write backup file; backing up in %s"
+			      (file-name-nondirectory backupname))
 		     (sleep-for 1)
 		     (condition-case ()
 			 (copy-file real-file-name backupname t t)
@@ -1850,7 +1862,11 @@
 	    (setq nogood t)
 	    ;; Find the temporary name to write under.
 	    (while nogood
-	      (setq tempname (format "%s#tmp#%d" dir i))
+	      (setq tempname (format
+			      (if (eq system-type 'ms-dos)
+				  "%s#%d.tm#" ; MSDOS limits files to 8+3
+				"%s#tmp#%d")
+			      dir i))
 	      (setq nogood (file-exists-p tempname))
 	      (setq i (1+ i)))
 	    (unwind-protect