diff options
| author | Geoff Voelker | 1997-07-20 01:30:54 +0000 |
|---|---|---|
| committer | Geoff Voelker | 1997-07-20 01:30:54 +0000 |
| commit | f473b0ca64984cf2d9427c3351f913a1d52c6f6b (patch) | |
| tree | 116d8b8a70c5e7e16321d8fe575221cc92824b12 /lisp | |
| parent | 072c1ebbf4d257608b922325e95ec6d8dcbad1d7 (diff) | |
| download | emacs-f473b0ca64984cf2d9427c3351f913a1d52c6f6b.tar.gz emacs-f473b0ca64984cf2d9427c3351f913a1d52c6f6b.zip | |
(find-buffer-file-type-coding-system):
Use undecided-dos for dos-text file names.
Use undecided for non-existing untranslated file names.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/dos-w32.el | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/lisp/dos-w32.el b/lisp/dos-w32.el index b5f52bb1716..d90c2e7696b 100644 --- a/lisp/dos-w32.el +++ b/lisp/dos-w32.el | |||
| @@ -29,11 +29,6 @@ | |||
| 29 | 29 | ||
| 30 | ;;; Code: | 30 | ;;; Code: |
| 31 | 31 | ||
| 32 | ;;; Add %t: into the mode line format just after the open-paren. | ||
| 33 | (let ((tail (member " %[(" mode-line-format))) | ||
| 34 | (setcdr tail (cons (purecopy "%t:") | ||
| 35 | (cdr tail)))) | ||
| 36 | |||
| 37 | ;; Use ";" instead of ":" as a path separator (from files.el). | 32 | ;; Use ";" instead of ":" as a path separator (from files.el). |
| 38 | (setq path-separator ";") | 33 | (setq path-separator ";") |
| 39 | 34 | ||
| @@ -92,36 +87,42 @@ against the file name, and TYPE is nil for text, t for binary.") | |||
| 92 | 87 | ||
| 93 | (defun find-buffer-file-type-coding-system (command args) | 88 | (defun find-buffer-file-type-coding-system (command args) |
| 94 | "Choose a coding system for a file operation. | 89 | "Choose a coding system for a file operation. |
| 95 | If COMMAND is 'insert-file-contents', the coding system is chosen based | 90 | If COMMAND is `insert-file-contents', the coding system is chosen based |
| 96 | upon the filename, the contents of 'untranslated-filesystem-list' and | 91 | upon the filename, the contents of `untranslated-filesystem-list' and |
| 97 | 'file-name-buffer-file-type-alist', and whether the file exists: | 92 | `file-name-buffer-file-type-alist', and whether the file exists: |
| 98 | 93 | ||
| 99 | If it matches in 'untranslated-filesystem-list': 'no-conversion' | 94 | If it matches in `untranslated-filesystem-list': |
| 100 | If it matches in 'file-name-buffer-file-type-alist': | 95 | If the file exists: `no-conversion' |
| 101 | If the match is t (for binary): 'no-conversion' | 96 | If the file does not exist: `undecided' |
| 102 | If the match is nil (for text): 'emacs-mule-dos' | 97 | If it matches in `file-name-buffer-file-type-alist': |
| 98 | If the match is t (for binary): `no-conversion' | ||
| 99 | If the match is nil (for dos-text): `undecided-dos' | ||
| 103 | Otherwise: | 100 | Otherwise: |
| 104 | If the file exists: 'undecided' | 101 | If the file exists: `undecided' |
| 105 | If the file does not exist: 'undecided-dos' | 102 | If the file does not exist: `undecided-dos' |
| 106 | 103 | ||
| 107 | If COMMAND is 'write-region', the coding system is chosen based | 104 | If COMMAND is `write-region', the coding system is chosen based |
| 108 | upon the value of 'buffer-file-type': If t, the coding system is | 105 | upon the value of `buffer-file-type': If t, the coding system is |
| 109 | 'no-conversion', otherwise it is 'emacs-mule-dos'." | 106 | `no-conversion', otherwise it is `undecided-dos'." |
| 110 | (let ((op (nth 0 command)) | 107 | (let ((op (nth 0 command)) |
| 111 | (target) | 108 | (target) |
| 112 | (binary nil) (text nil) | 109 | (binary nil) (text nil) |
| 113 | (undecided nil)) | 110 | (undecided nil)) |
| 114 | (cond ((eq op 'insert-file-contents) | 111 | (cond ((eq op 'insert-file-contents) |
| 115 | (setq target (nth 1 command)) | 112 | (setq target (nth 1 command)) |
| 116 | (setq binary (find-buffer-file-type target)) | 113 | (if (untranslated-file-p target) |
| 117 | (unless binary | 114 | (if (file-exists-p target) |
| 118 | (if (find-buffer-file-type-match target) | 115 | (setq undecided t) |
| 119 | (setq text t) | 116 | (setq binary t)) |
| 120 | (setq undecided (file-exists-p target))))) | 117 | (setq binary (find-buffer-file-type target)) |
| 118 | (unless binary | ||
| 119 | (if (find-buffer-file-type-match target) | ||
| 120 | (setq text t) | ||
| 121 | (setq undecided (file-exists-p target)))))) | ||
| 121 | ((eq op 'write-region) | 122 | ((eq op 'write-region) |
| 122 | (setq binary buffer-file-type))) | 123 | (setq binary buffer-file-type))) |
| 123 | (cond (binary '(no-conversion . no-conversion)) | 124 | (cond (binary '(no-conversion . no-conversion)) |
| 124 | (text '(emacs-mule-dos . emacs-mule-dos)) | 125 | (text '(undecided-dos . undecided-dos)) |
| 125 | (undecided '(undecided . undecided)) | 126 | (undecided '(undecided . undecided)) |
| 126 | (t '(undecided-dos . undecided-dos))))) | 127 | (t '(undecided-dos . undecided-dos))))) |
| 127 | 128 | ||
| @@ -214,11 +215,11 @@ filesystem mounted on drive Z:, FILESYSTEM could be \"Z:\"." | |||
| 214 | (defun find-binary-process-coding-system (op args) | 215 | (defun find-binary-process-coding-system (op args) |
| 215 | "Choose a coding system for process I/O. | 216 | "Choose a coding system for process I/O. |
| 216 | The coding system for decode is 'no-conversion' if 'binary-process-output' | 217 | The coding system for decode is 'no-conversion' if 'binary-process-output' |
| 217 | is non-nil, and 'emacs-mule-dos' otherwise. Similarly, the coding system | 218 | is non-nil, and 'undecided-dos' otherwise. Similarly, the coding system |
| 218 | for encode is 'no-conversion' if 'binary-process-input' is non-nil, | 219 | for encode is 'no-conversion' if 'binary-process-input' is non-nil, |
| 219 | and 'emacs-mule-dos' otherwise." | 220 | and 'undecided-dos' otherwise." |
| 220 | (let ((decode 'emacs-mule-dos) | 221 | (let ((decode 'undecided-dos) |
| 221 | (encode 'emacs-mule-dos)) | 222 | (encode 'undecided-dos)) |
| 222 | (if binary-process-output | 223 | (if binary-process-output |
| 223 | (setq decode 'no-conversion)) | 224 | (setq decode 'no-conversion)) |
| 224 | (if binary-process-input | 225 | (if binary-process-input |