]> git.eshelyaron.com Git - emacs.git/commitdiff
Make dired-buffers-for-dir expand the DIR argument
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 10 Dec 2021 11:32:49 +0000 (12:32 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 10 Dec 2021 11:32:49 +0000 (12:32 +0100)
* lisp/dired.el (dired-buffers-for-dir): Expand DIR argument
(bug#52395).
(dired-find-buffer-nocreate, dired-clean-up-after-deletion):
Adjust callers.

lisp/dired.el

index d0e547ba0b157388faf3db50ca0129c7d3c0f311..4e2a32de6764a4dc6a802b4b659c97ffd842a68b 100644 (file)
@@ -1265,8 +1265,7 @@ The return value is the target column for the file names."
            ;; Don't try to find a wildcard as a subdirectory.
           (string-equal dirname (file-name-directory dirname)))
       (let* ((cur-buf (current-buffer))
-            (buffers (nreverse
-                      (dired-buffers-for-dir (expand-file-name dirname))))
+            (buffers (nreverse (dired-buffers-for-dir dirname)))
             (cur-buf-matches (and (memq cur-buf buffers)
                                   ;; Wildcards must match, too:
                                   (equal dired-directory dirname))))
@@ -2967,7 +2966,7 @@ directories below DIR.
 The list is in reverse order of buffer creation, most recent last.
 As a side effect, killed dired buffers for DIR are removed from
 `dired-buffers'."
-  (setq dir (file-name-as-directory dir))
+  (setq dir (file-name-as-directory (expand-file-name dir)))
   (let (result buf)
     (dolist (elt dired-buffers)
       (setq buf (cdr elt))
@@ -3518,7 +3517,7 @@ If the buffer has a wildcard pattern, check that it matches FILE.
 FILE may be nil, in which case ignore it.
 Return list of buffers where FUN succeeded (i.e., returned non-nil)."
   (let (success-list)
-    (dolist (buf (dired-buffers-for-dir (expand-file-name directory) file))
+    (dolist (buf (dired-buffers-for-dir directory file))
       (with-current-buffer buf
        (when (apply fun args)
          (push (buffer-name buf) success-list))))
@@ -3567,8 +3566,7 @@ confirmation.  To disable the confirmation, see
                                      (file-name-nondirectory fn))))
                (not dired-clean-confirm-killing-deleted-buffers))
            (kill-buffer buf)))
-    (let ((buf-list (dired-buffers-for-dir (expand-file-name fn)
-                                           nil 'subdirs)))
+    (let ((buf-list (dired-buffers-for-dir fn nil 'subdirs)))
       (and buf-list
            (or (and dired-clean-confirm-killing-deleted-buffers
                     (y-or-n-p