From: Michael Albinus Date: Fri, 7 Oct 2022 11:14:46 +0000 (+0200) Subject: * lisp/dired.el (dired-make-relative): Make change less aggressive. X-Git-Tag: emacs-29.0.90~1616^2~721 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=17d0f61c808c3d288de246518c1ed73e64e94b1d;p=emacs.git * lisp/dired.el (dired-make-relative): Make change less aggressive. --- diff --git a/lisp/dired.el b/lisp/dired.el index f9a77431393..85a71315702 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))