>From e3e91263438d378047c1c3e37faa8a815d182683 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Sat, 12 Jun 2021 12:39:35 +0100 Subject: [PATCH] Remove obsolete uses of dired-in-this-tree-p * lisp/dired.el (dired-in-this-tree-p): Promote commentary to docstring. Replace make-obsolete with equivalent declare form. * lisp/dired-aux.el (dired-rename-subdir, dired-rename-subdir-1) (dired-insert-subdir, dired-insert-subdir-validate) (dired-kill-tree, dired-tree-down): Replace obsolete dired-in-this-tree-p with its moral equivalent file-in-directory-p. --- lisp/dired-aux.el | 12 ++++++------ lisp/dired.el | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 3a721cd4d9..7d50b60000 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1859,7 +1859,7 @@ dired-rename-subdir (while blist (with-current-buffer (car blist) (if (and buffer-file-name - (dired-in-this-tree-p buffer-file-name expanded-from-dir)) + (file-in-directory-p buffer-file-name expanded-from-dir)) (let ((modflag (buffer-modified-p)) (to-file (replace-regexp-in-string (concat "^" (regexp-quote from-dir)) @@ -1878,7 +1878,7 @@ dired-rename-subdir-1 (while alist (setq elt (car alist) alist (cdr alist)) - (if (dired-in-this-tree-p (car elt) expanded-dir) + (if (file-in-directory-p (car elt) expanded-dir) ;; ELT's subdir is affected by the rename (dired-rename-subdir-2 elt dir to))) (if (equal dir default-directory) @@ -2707,7 +2707,7 @@ dired-insert-subdir (setq switches (string-replace "R" "" switches)) (dolist (cur-ass dired-subdir-alist) (let ((cur-dir (car cur-ass))) - (and (dired-in-this-tree-p cur-dir dirname) + (and (file-in-directory-p cur-dir dirname) (let ((cur-cons (assoc-string cur-dir dired-switches-alist))) (if cur-cons (setcdr cur-cons switches) @@ -2719,7 +2719,7 @@ dired-insert-subdir (defun dired-insert-subdir-validate (dirname &optional switches) ;; Check that it is valid to insert DIRNAME with SWITCHES. ;; Signal an error if invalid (e.g. user typed `i' on `..'). - (or (dired-in-this-tree-p dirname (expand-file-name default-directory)) + (or (file-in-directory-p dirname (expand-file-name default-directory)) (error "%s: not in this directory tree" dirname)) (let ((real-switches (or switches dired-subdir-switches))) (when real-switches @@ -2760,7 +2760,7 @@ dired-kill-tree (setq dir (car (car s-alist)) s-alist (cdr s-alist)) (and (or kill-root (not (string-equal dir dirname))) - (dired-in-this-tree-p dir dirname) + (file-in-directory-p dir dirname) (dired-goto-subdir dir) (setq m-alist (nconc (dired-kill-subdir remember-marks) m-alist)))) m-alist)) @@ -2992,7 +2992,7 @@ dired-tree-down (while rest (setq elt (car rest) rest (cdr rest)) - (if (dired-in-this-tree-p (directory-file-name (car elt)) dir) + (if (file-in-directory-p (directory-file-name (car elt)) dir) (setq rest nil pos (dired-goto-subdir (car elt)))))) (if pos diff --git a/lisp/dired.el b/lisp/dired.el index bb428e2198..8c7bff31cb 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2912,10 +2912,10 @@ dired-unadvertise ;;; utility functions (defun dired-in-this-tree-p (file dir) - ;;"Is FILE part of the directory tree starting at DIR?" + "Return non-nil if FILE is part of the directory tree starting at DIR." + (declare (obsolete file-in-directory-p "28.1")) (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") -- 2.30.2