]> code.delx.au - gnu-emacs/blobdiff - lisp/files.el
*** empty log message ***
[gnu-emacs] / lisp / files.el
index 5ba163fc67150b40f8659e1afd04eeb7c865ba64..acfea07992f5c46d5351a23e9308776bbbca2972 100644 (file)
@@ -682,10 +682,8 @@ Do not specify them in other calls."
            (setq filename (funcall handler 'file-truename filename))
          ;; If filename contains a wildcard, newname will be the old name.
          (unless (string-match "[[*?]" filename)
-           ;; If filename exists, use the long name, otherwise
-           ;; canonicalize the name, to handle case differences.
-           (setq filename (or (w32-long-file-name filename)
-                              (untranslated-canonical-name filename)))))
+           ;; If filename exists, use the long name
+           (setq filename (or (w32-long-file-name filename) filename))))
        (setq done t)))
 
     ;; If this file directly leads to a link, process that iteratively
@@ -940,7 +938,7 @@ If the current buffer now contains an empty file that you just visited
   (let ((obuf (current-buffer))
        (ofile buffer-file-name)
        (onum buffer-file-number)
-       (odir (bound-and-true-p dired-directory))
+       (odir dired-directory)
        (otrue buffer-file-truename)
        (oname (buffer-name)))
     (if (get-buffer " **lose**")
@@ -998,8 +996,8 @@ Choose the buffer's name using `generate-new-buffer-name'."
 
 (defun abbreviate-file-name (filename)
   "Return a version of FILENAME shortened using `directory-abbrev-alist'.
-This also substitutes \"~\" for the user's home directory.
-Type \\[describe-variable] directory-abbrev-alist RET for more information."
+This also substitutes \"~\" for the user's home directory and
+removes automounter prefixes (see the variable `automount-dir-prefix')."
   ;; Get rid of the prefixes added by the automounter.
   (if (and automount-dir-prefix
           (string-match automount-dir-prefix filename)
@@ -1606,6 +1604,7 @@ in that case, this function acts as if `enable-local-variables' were t."
      ("\\.oak\\'" . scheme-mode)
      ("\\.sgml?\\'" . sgml-mode)
      ("\\.xml\\'" . sgml-mode)
+     ("\\.xsl\\'" . sgml-mode)
      ("\\.dtd\\'" . sgml-mode)
      ("\\.ds\\(ss\\)?l\\'" . dsssl-mode)
      ("\\.idl\\'" . idl-mode)
@@ -3364,7 +3363,10 @@ non-nil, it is called instead of rereading visited file contents."
                     (funcall revert-buffer-insert-file-contents-function
                              file-name auto-save-p)
                   (if (not (file-exists-p file-name))
-                      (error "File %s no longer exists!" file-name))
+                      (error (if buffer-file-number
+                                 "File %s no longer exists!"
+                               "Cannot revert nonexistent file %s")
+                             file-name))
                   ;; Bind buffer-file-name to nil
                   ;; so that we don't try to lock the file.
                   (let ((buffer-file-name nil))
@@ -3465,7 +3467,13 @@ Then you'll be asked about a number of files to recover."
       (error "You set `auto-save-list-file-prefix' to disable making session files"))
   (let ((dir (file-name-directory auto-save-list-file-prefix)))
     (unless (file-directory-p dir)
-      (make-directory dir t)))
+      (make-directory dir t))
+    (unless (directory-files dir nil
+                            (concat "\\`" (regexp-quote
+                                           (file-name-nondirectory
+                                            auto-save-list-file-prefix)))
+                            t)
+      (error "No previous sessions to recover")))
   (let ((ls-lisp-support-shell-wildcards t))
     (dired (concat auto-save-list-file-prefix "*")
           (concat dired-listing-switches "t")))
@@ -4112,27 +4120,42 @@ If WILDCARD, it also runs the shell specified by `shell-file-name'."
              (while (< (point) end)
                (let ((start (+ beg (read (current-buffer))))
                      (end (+ beg (read (current-buffer)))))
-                 (put-text-property start end 'dired-filename t)))
+                 (if (= (char-after end) ?\n)
+                     (put-text-property start end 'dired-filename t)
+                   ;; It seems that we can't trust ls's output as to
+                   ;; byte positions of filenames.
+                   (put-text-property beg (point) 'dired-filename nil)
+                   (end-of-line))))
              (goto-char end)
              (beginning-of-line)
              (delete-region (point) (progn (forward-line 2) (point)))))
 
          ;; Now decode what read if necessary.
-         (let ((coding (or coding-system-for-write
-                           (detect-coding-region beg (point) t)))
+         (let ((coding (or coding-system-for-read
+                           file-name-coding-system
+                           default-file-name-coding-system
+                           'undecided))
                val pos)
-           (if (not (eq (coding-system-base coding) 'undecided))
-               (save-restriction
-                 (narrow-to-region beg (point))
-                 (goto-char (point-min))
-                 (while (not (eobp))
-                   (setq pos (point)
-                         val (get-text-property (point) 'dired-filename))
-                   (goto-char (next-single-property-change
-                               (point) 'dired-filename nil (point-max)))
-                   (decode-coding-region pos (point) coding)
-                   (if val
-                       (put-text-property pos (point) 'dired-filename t))))))
+           (when (and enable-multibyte-characters
+                      (not (memq (coding-system-base coding)
+                                 '(raw-text no-conversion))))
+             ;; If no coding system is specified or detection is
+             ;; requested, detect the coding.
+             (if (eq (coding-system-base coding) 'undecided)
+                 (setq coding (detect-coding-region beg (point) t)))
+             (if (not (eq (coding-system-base coding) 'undecided))
+                 (save-restriction
+                   (narrow-to-region beg (point))
+                   (goto-char (point-min))
+                   (while (not (eobp))
+                     (setq pos (point)
+                           val (get-text-property (point) 'dired-filename))
+                     (goto-char (next-single-property-change
+                                 (point) 'dired-filename nil (point-max)))
+                     (decode-coding-region pos (point) coding)
+                     (if val
+                         (put-text-property pos (point)
+                                            'dired-filename t)))))))
 
          (if full-directory-p
              ;; Try to insert the amount of free space.