]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/dired.el (dired-make-relative): Make change less aggressive.
authorMichael Albinus <michael.albinus@gmx.de>
Fri, 7 Oct 2022 11:14:46 +0000 (13:14 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Fri, 7 Oct 2022 11:14:46 +0000 (13:14 +0200)
lisp/dired.el

index f9a77431393812f8f7c6b6f9883fd9d06ff93dd6..85a7131570216ba9d0019f048856a58b3c4cdd5e 100644 (file)
@@ -2953,7 +2953,11 @@ 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."
-  (setq dir (expand-file-name (or dir default-directory)))
+  (or dir (setq dir default-directory))
+  ;; This case comes into play if default-directory is set to
+  ;; use ~.
+  (if (string-match-p "\\(\\`\\|:\\)~" dir)
+      (setq dir (expand-file-name dir)))
   (if (string-match (concat "^" (regexp-quote dir)) file)
       (substring file (match-end 0))
     file))