]> code.delx.au - gnu-emacs/blobdiff - lisp/dos-w32.el
*** empty log message ***
[gnu-emacs] / lisp / dos-w32.el
index 612191c75aaec8ae822cb6a8300d8e482672b189..bedaa0b996cff5acbccc93370a214aa6831feb38 100644 (file)
 ;; Set the null device (for compile.el).
 (setq null-device "NUL")
 
-;; Set the grep regexp to match entries with drive letters.
-(setq grep-regexp-alist
-  '(("^\\(\\([a-zA-Z]:\\)?[^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 3)))
-
 ;; For distinguishing file types based upon suffixes.
 (defvar file-name-buffer-file-type-alist
   '(
@@ -50,7 +46,7 @@
                                        ; MS-Dos stuff
     ("\\.\\(dll\\|drv\\|386\\|vxd\\|fon\\|fnt\\|fot\\|ttf\\|grp\\)$" . t)
                                        ; Windows stuff
-    ("\\.\\(bmp\\|wav\\|avi\\|mpg\\|jpg\\|tif\\|mov\\|au\\)" . t)
+    ("\\.\\(bmp\\|wav\\|avi\\|mpg\\|jpg\\|tif\\|mov\\|au\\)$" . t)
                                        ; known binary data files
     ("\\.\\(arc\\|zip\\|pak\\|lzh\\|zoo\\)$" . t)
                                        ; Packers
@@ -98,8 +94,8 @@ upon the filename, the contents of `untranslated-filesystem-list' and
 `file-name-buffer-file-type-alist', and whether the file exists:
 
   If it matches in `untranslated-filesystem-list':
-    If the file exists:                                        `no-conversion'
-    If the file does not exist:                                `undecided'
+    If the file exists:                                        `undecided'
+    If the file does not exist:                                `undecided-unix'
   If it matches in `file-name-buffer-file-type-alist':
     If the match is t (for binary):                    `no-conversion'
     If the match is nil (for dos-text):                        `undecided-dos'
@@ -177,10 +173,16 @@ set to the appropriate coding system, and the value of
 (defun find-file-not-found-set-buffer-file-coding-system ()
   (save-excursion
     (set-buffer (current-buffer))
-    (let* ((dummy-insert-op (list 'insert-file-contents (buffer-file-name)))
-          (coding-system-pair
-           (find-buffer-file-type-coding-system dummy-insert-op)))
-      (setq buffer-file-coding-system (car coding-system-pair))
+    (let ((coding buffer-file-coding-system))
+      ;; buffer-file-coding-system is already set by
+      ;; find-operation-coding-system, which was called from
+      ;; insert-file-contents.  All that's left is to change
+      ;; the EOL conversion, if required by the user.
+      (when (and (null coding-system-for-read)
+                (or inhibit-eol-conversion
+                    (untranslated-file-p (buffer-file-name))))
+       (setq coding (coding-system-change-eol-conversion coding 0))
+       (setq buffer-file-coding-system coding))
       (setq buffer-file-type (eq buffer-file-coding-system 'no-conversion)))))
 
 ;;; To set the default coding system on new files.
@@ -208,7 +210,10 @@ dealing with untranslated filesystems."
                    filename nil))
        ;; Use expand-file-name to canonicalize directory separators, except
        ;; with bare drive letters (which would have the cwd appended).
-       (if (string-match "^.:$" name)
+       ;; Avoid expanding names that could trigger ange-ftp to prompt
+       ;; for passwords, though.
+       (if (or (string-match "^.:$" name)
+               (string-match "^/[^/:]+:" name))
            name
          (expand-file-name name)))
     filename))
@@ -230,7 +235,10 @@ CR/LF translation, and nil otherwise."
 CR/LF translation.  FILESYSTEM is a string containing the directory
 prefix corresponding to the filesystem.  For example, for a Unix 
 filesystem mounted on drive Z:, FILESYSTEM could be \"Z:\"."
-  (interactive "fUntranslated file system: ")
+  ;; We use "D", not "f", to avoid confusing the user: "f" prompts
+  ;; with a directory, but RET returns the current buffer's file, not
+  ;; its directory.
+  (interactive "DUntranslated file system: ")
   (let ((fs (untranslated-canonical-name filesystem)))
     (if (member fs untranslated-filesystem-list)
        untranslated-filesystem-list
@@ -276,7 +284,7 @@ filesystem mounted on drive Z:, FILESYSTEM could be \"Z:\"."
          (subst-char-in-string
           ?/ ?\\
           (make-temp-name
-           (expand-file-name "EP" (getenv "TMPDIR")))))
+           (expand-file-name "EP" temporary-file-directory))))
         ;; capture output for diagnosis
         (errbuf (list (get-buffer-create " *print-region-helper*") t)))
     ;; It seems that we must be careful about the directory name that