]> git.eshelyaron.com Git - emacs.git/commitdiff
Un-obsolete dired-in-this-tree-p and use it again in certain places.
authorTassilo Horn <tsdh@gnu.org>
Sun, 8 Aug 2021 14:45:50 +0000 (16:45 +0200)
committerTassilo Horn <tsdh@gnu.org>
Sun, 8 Aug 2021 19:06:17 +0000 (21:06 +0200)
This reverts parts of b425966b07, and 7b50ed553f, i.e. it reverts the
obsoletion of dired-in-this-tree-p and switches some new callers of
file-in-directory-p back to using dired-in-this-tree-p.

It turned out that using file-in-directory-p can be a major
performance regression in case you have a dired buffer of a remote
directory which has become (almost) inaccessible.

Any attempt to open a new dired buffer is checking if a buffer for
that directory already exists (in terms of dired-buffers-for-dir)
which meant that file-in-directory-p was called with the directory of
any existing dired buffer including the inaccessible one where the
file-truename call in file-in-directory-p could block for seconds or
even minutes.

* lisp/dired.el (dired-in-this-tree-p): Undo obsoletion.
(dired-buffers-for-dir): Use dired-in-this-tree-p as before.
* lisp/dired-aux.el (dired-kill-tree,dired-tree-down): Une
dired-in-this-tree-p as before.

lisp/dired-aux.el
lisp/dired.el

index 72969dd96e27c0cf0249c0518952705d334b1aea..5dbd55849e9fc419ea0d3fb5b51a4f6a9e2f7a47 100644 (file)
@@ -2769,7 +2769,7 @@ of marked files.  If KILL-ROOT is non-nil, kill DIRNAME as well."
       (setq dir (car (car s-alist))
            s-alist (cdr s-alist))
       (and (or kill-root (not (string-equal dir dirname)))
-          (file-in-directory-p dir dirname)
+          (dired-in-this-tree-p dir dirname)
           (dired-goto-subdir dir)
           (setq m-alist (nconc (dired-kill-subdir remember-marks) m-alist))))
     m-alist))
@@ -3002,7 +3002,7 @@ Lower levels are unaffected."
       (while rest
        (setq elt (car rest)
              rest (cdr rest))
-       (if (file-in-directory-p (directory-file-name (car elt)) dir)
+       (if (dired-in-this-tree-p (directory-file-name (car elt)) dir)
            (setq rest nil
                  pos (dired-goto-subdir (car elt))))))
     (if pos
index e577df510ad7d91eedb17a689e08c8c6933e2ca2..816b8b69881171af7e3f17c372259c56e3196f4d 100644 (file)
@@ -2872,7 +2872,7 @@ dired-buffers."
        ((null (buffer-name buf))
        ;; Buffer is killed - clean up:
        (setq dired-buffers (delq elt dired-buffers)))
-       ((file-in-directory-p (car elt) dir)
+       ((dired-in-this-tree-p (car elt) dir)
        (with-current-buffer buf
           (when (and (or subdirs
                          (assoc dir dired-subdir-alist))
@@ -2947,7 +2947,7 @@ dired-buffers."
   ;;"Is FILE part of the directory tree starting at DIR?"
   (let (case-fold-search)
     (string-match-p (concat "^" (regexp-quote dir)) file)))
-(make-obsolete 'dired-in-this-tree-p 'file-in-directory-p "28.1")
+
 (define-obsolete-function-alias 'dired-in-this-tree
   'dired-in-this-tree-p "27.1")