emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 17d0f61c80: * lisp/dired.el (dired-make-relative): Make change le


From: Michael Albinus
Subject: master 17d0f61c80: * lisp/dired.el (dired-make-relative): Make change less aggressive.
Date: Fri, 7 Oct 2022 07:14:58 -0400 (EDT)

branch: master
commit 17d0f61c808c3d288de246518c1ed73e64e94b1d
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    * lisp/dired.el (dired-make-relative): Make change less aggressive.
---
 lisp/dired.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/dired.el b/lisp/dired.el
index f9a7743139..85a7131570 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]