summaryrefslogtreecommitdiff
path: root/lisp/dired.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/dired.el')
-rw-r--r--lisp/dired.el6
1 files changed, 1 insertions, 5 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index 96b580d5763..f9a77431393 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2953,11 +2953,7 @@ Optional arg GLOBAL means to replace all matches."
If DIR is omitted or nil, it defaults to `default-directory'.
If FILE is not in the directory tree of DIR, return FILE
unchanged."
- (or dir (setq dir default-directory))
- ;; This case comes into play if default-directory is set to
- ;; use ~.
- (if (and (> (length dir) 0) (= (aref dir 0) ?~))
- (setq dir (expand-file-name dir)))
+ (setq dir (expand-file-name (or dir default-directory)))
(if (string-match (concat "^" (regexp-quote dir)) file)
(substring file (match-end 0))
file))