# HG changeset patch # User Richard M. Stallman # Date 873133481 0 # Node ID 98e7893f8679f982f2b4b63cb0ea543ecab6fbeb # Parent 47d11f4bbc6cd550af7c337ee794fe4e97813cb8 (find-buffer-file-type): Don't check for untranslated file systems here. (find-buffer-file-type-coding-system): For reading a file, check for binary file, then text file, then existing file, then whether file name is translated. diff -r 47d11f4bbc6c -r 98e7893f8679 lisp/dos-w32.el --- a/lisp/dos-w32.el Mon Sep 01 12:36:34 1997 +0000 +++ b/lisp/dos-w32.el Mon Sep 01 17:04:41 1997 +0000 @@ -72,18 +72,16 @@ (setq alist (cdr alist))) found))) +;; Don't check for untranslated file systems here. (defun find-buffer-file-type (filename) - ;; First check if file is on an untranslated filesystem, then on the alist. - (if (untranslated-file-p filename) - t ; for binary - (let ((match (find-buffer-file-type-match filename)) - (code)) - (if (not match) - default-buffer-file-type - (setq code (cdr match)) - (cond ((memq code '(nil t)) code) - ((and (symbolp code) (fboundp code)) - (funcall code filename))))))) + (let ((match (find-buffer-file-type-match filename)) + (code)) + (if (not match) + default-buffer-file-type + (setq code (cdr match)) + (cond ((memq code '(nil t)) code) + ((and (symbolp code) (fboundp code)) + (funcall code filename)))))) (setq-default buffer-file-coding-system 'undecided-dos) @@ -123,26 +121,34 @@ (let ((op (nth 0 command)) (target) (binary nil) (text nil) - (undecided nil)) + (undecided nil) (undecided-unix nil)) (cond ((eq op 'insert-file-contents) (setq target (nth 1 command)) - (if (untranslated-file-p target) - (if (file-exists-p target) - (setq undecided t) - (setq binary t)) - (setq binary (find-buffer-file-type target)) - (unless binary - (if (find-buffer-file-type-match target) - (setq text t) - (setq undecided (file-exists-p target))))) + ;; First check for a file name that indicates + ;; it is truly binary. + (setq binary (find-buffer-file-type target)) + (cond (binary) + ;; Next check for files that MUST use DOS eol conversion. + ((find-buffer-file-type-match target) + (setq text t)) + ;; For any other existing file, decide based on contents. + ((file-exists-p target) + (setq undecided t)) + ;; Next check for a non-DOS file system. + ((untranslated-file-p target) + (setq undecided-unix t))) (cond (binary '(no-conversion . no-conversion)) (text '(undecided-dos . undecided-dos)) + (undecided-unix '(undecided-unix . undecided-unix)) (undecided '(undecided . undecided)) (t '(undecided-dos . undecided-dos)))) ((eq op 'write-region) (if buffer-file-coding-system (cons buffer-file-coding-system buffer-file-coding-system) + ;; Normally this is used only in a non-file-visiting + ;; buffer, because normally buffer-file-coding-system is non-nil + ;; in a file-visiting buffer. (if buffer-file-type '(no-conversion . no-conversion) '(undecided-dos . undecided-dos)))))))