diff options
| author | Richard M. Stallman | 1996-01-01 22:51:51 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-01-01 22:51:51 +0000 |
| commit | 567c1ca939067d178a440c5d3a0b33c320e85f41 (patch) | |
| tree | a12ff8b023bbf42e287123e7510de0b97a99a058 | |
| parent | a8a7d065bd14a0fa729d76fef3d87a2f7e7c2b14 (diff) | |
| download | emacs-567c1ca939067d178a440c5d3a0b33c320e85f41.tar.gz emacs-567c1ca939067d178a440c5d3a0b33c320e85f41.zip | |
(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.
| -rw-r--r-- | lisp/files.el | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/lisp/files.el b/lisp/files.el index 969da941f89..17a3f4c7a61 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -252,6 +252,13 @@ and ignores this variable.") | |||
| 252 | inhibit-file-name-handlers))) | 252 | inhibit-file-name-handlers))) |
| 253 | (inhibit-file-name-operation op)) | 253 | (inhibit-file-name-operation op)) |
| 254 | (apply op args)))) | 254 | (apply op args)))) |
| 255 | |||
| 256 | (defun convert-standard-filename (filename) | ||
| 257 | "Convert a standard file's name to something suitable for the current OS. | ||
| 258 | This function's standard definition is trivial; it just returns the argument. | ||
| 259 | However, on some systems, the function is redefined | ||
| 260 | with a definition that really does change some file names." | ||
| 261 | filename) | ||
| 255 | 262 | ||
| 256 | (defun pwd () | 263 | (defun pwd () |
| 257 | "Show the current default directory." | 264 | "Show the current default directory." |
| @@ -630,10 +637,12 @@ Type \\[describe-variable] directory-abbrev-alist RET for more information." | |||
| 630 | ;; If the home dir is just /, don't change it. | 637 | ;; If the home dir is just /, don't change it. |
| 631 | (not (and (= (match-end 0) 1) | 638 | (not (and (= (match-end 0) 1) |
| 632 | (= (aref filename 0) ?/))) | 639 | (= (aref filename 0) ?/))) |
| 640 | ;; MS-DOS root directories can come with a drive letter; | ||
| 641 | ;; Novell Netware allows drive letters beyond `Z:'. | ||
| 633 | (not (and (or (eq system-type 'ms-dos) | 642 | (not (and (or (eq system-type 'ms-dos) |
| 634 | (eq system-type 'windows-nt)) | 643 | (eq system-type 'windows-nt)) |
| 635 | (save-match-data | 644 | (save-match-data |
| 636 | (string-match "^[a-zA-Z]:/$" filename))))) | 645 | (string-match "^[a-zA-`]:/$" filename))))) |
| 637 | (setq filename | 646 | (setq filename |
| 638 | (concat "~" | 647 | (concat "~" |
| 639 | (substring filename (match-beginning 1) (match-end 1)) | 648 | (substring filename (match-beginning 1) (match-end 1)) |
| @@ -886,7 +895,7 @@ run `normal-mode' explicitly." | |||
| 886 | (prin1-to-string err))))) | 895 | (prin1-to-string err))))) |
| 887 | 896 | ||
| 888 | (defvar auto-mode-alist | 897 | (defvar auto-mode-alist |
| 889 | '(("\\.text\\'" . text-mode) | 898 | '(("\\.te?xt\\'" . text-mode) |
| 890 | ("\\.c\\'" . c-mode) | 899 | ("\\.c\\'" . c-mode) |
| 891 | ("\\.h\\'" . c-mode) | 900 | ("\\.h\\'" . c-mode) |
| 892 | ("\\.tex\\'" . tex-mode) | 901 | ("\\.tex\\'" . tex-mode) |
| @@ -921,7 +930,7 @@ run `normal-mode' explicitly." | |||
| 921 | ;;; Less common extensions come here | 930 | ;;; Less common extensions come here |
| 922 | ;;; so more common ones above are found faster. | 931 | ;;; so more common ones above are found faster. |
| 923 | ("\\.texinfo\\'" . texinfo-mode) | 932 | ("\\.texinfo\\'" . texinfo-mode) |
| 924 | ("\\.texi\\'" . texinfo-mode) | 933 | ("\\.te?xi\\'" . texinfo-mode) |
| 925 | ("\\.s\\'" . asm-mode) | 934 | ("\\.s\\'" . asm-mode) |
| 926 | ("\\.S\\'" . asm-mode) | 935 | ("\\.S\\'" . asm-mode) |
| 927 | ("\\.asm\\'" . asm-mode) | 936 | ("\\.asm\\'" . asm-mode) |
| @@ -1521,8 +1530,11 @@ the modes of the new file to agree with the old modes." | |||
| 1521 | (setq setmodes (file-modes backupname))) | 1530 | (setq setmodes (file-modes backupname))) |
| 1522 | (file-error | 1531 | (file-error |
| 1523 | ;; If trouble writing the backup, write it in ~. | 1532 | ;; If trouble writing the backup, write it in ~. |
| 1524 | (setq backupname (expand-file-name "~/%backup%~")) | 1533 | (setq backupname (expand-file-name |
| 1525 | (message "Cannot write backup file; backing up in ~/%%backup%%~") | 1534 | (convert-standard-filename |
| 1535 | "~/%backup%~"))) | ||
| 1536 | (message "Cannot write backup file; backing up in %s" | ||
| 1537 | (file-name-nondirectory backupname)) | ||
| 1526 | (sleep-for 1) | 1538 | (sleep-for 1) |
| 1527 | (condition-case () | 1539 | (condition-case () |
| 1528 | (copy-file real-file-name backupname t t) | 1540 | (copy-file real-file-name backupname t t) |
| @@ -1850,7 +1862,11 @@ After saving the buffer, run `after-save-hook'." | |||
| 1850 | (setq nogood t) | 1862 | (setq nogood t) |
| 1851 | ;; Find the temporary name to write under. | 1863 | ;; Find the temporary name to write under. |
| 1852 | (while nogood | 1864 | (while nogood |
| 1853 | (setq tempname (format "%s#tmp#%d" dir i)) | 1865 | (setq tempname (format |
| 1866 | (if (eq system-type 'ms-dos) | ||
| 1867 | "%s#%d.tm#" ; MSDOS limits files to 8+3 | ||
| 1868 | "%s#tmp#%d") | ||
| 1869 | dir i)) | ||
| 1854 | (setq nogood (file-exists-p tempname)) | 1870 | (setq nogood (file-exists-p tempname)) |
| 1855 | (setq i (1+ i))) | 1871 | (setq i (1+ i))) |
| 1856 | (unwind-protect | 1872 | (unwind-protect |