summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2002-02-06 15:30:40 +0000
committerRichard M. Stallman <rms@gnu.org>2002-02-06 15:30:40 +0000
commitb95ddab3b26629a557101b2066b237579b4d0c55 (patch)
tree306d4037646649f5feb7bf0908fb81f55f1717a0 /lisp
parentc736f678a2bc75392f03fea21d2ec85b1ff0f25f (diff)
downloademacs-b95ddab3b26629a557101b2066b237579b4d0c55.tar.gz
(dired-get-filename): Add /: when appropriate
to avoid taking a local name as remote.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/dired.el15
1 files changed, 13 insertions, 2 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index 43d03627a98..7c95bbe51ab 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -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)