]> git.eshelyaron.com Git - emacs.git/commitdiff
(dired-get-filename): Add /: when appropriate
authorRichard M. Stallman <rms@gnu.org>
Wed, 6 Feb 2002 15:30:40 +0000 (15:30 +0000)
committerRichard M. Stallman <rms@gnu.org>
Wed, 6 Feb 2002 15:30:40 +0000 (15:30 +0000)
to avoid taking a local name as remote.

lisp/dired.el

index 43d03627a98482afa09cd035a19a5ee8f85d14d4..7c95bbe51ab7d8c33ecb0b5755b3364c96c0cfe4 100644 (file)
@@ -1425,14 +1425,25 @@ Optional arg NO-ERROR-IF-NOT-FILEP means return nil if no filename on
         (not default-file-name-coding-system)
         (setq file (encode-coding-string file buffer-file-coding-system)))
     (cond
+     ((null file)
+      nil)
      ((eq localp 'verbatim)
       file)
      ((and (eq localp 'no-dir) already-absolute)
       (file-name-nondirectory file))
-     ((or already-absolute (eq localp 'no-dir))
+     (already-absolute
+      (if (find-file-name-handler file nil)
+         (concat "/:" file)
+       file))
+     ((eq localp 'no-dir)
       file)
+     ((equal (dired-current-directory) "/")
+      (setq file (concat (dired-current-directory localp) file))
+      (if (find-file-name-handler file nil)
+         (concat "/:" file)
+       file))
      (t
-      (and file (concat (dired-current-directory localp) file))))))
+      (concat (dired-current-directory localp) file)))))
 
 (defun dired-string-replace-match (regexp string newtext
                                          &optional literal global)