aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTino Calancha2019-07-13 04:03:50 +0200
committerLars Ingebrigtsen2019-07-13 04:03:50 +0200
commit4b73c0cde662f894292bebadcd530dc7b232829d (patch)
tree614450f3dc3634c98863769cdef71734bd60a359
parent936d074d7c58bd4504b89a0b739b370312ae141a (diff)
downloademacs-4b73c0cde662f894292bebadcd530dc7b232829d.tar.gz
emacs-4b73c0cde662f894292bebadcd530dc7b232829d.zip
End predicate `dired-in-this-tree' with '-p'
* lisp/dired.el(dired-in-this-tree-p): Rename from `dired-in-this-tree'. Add docstring. (dired-in-this-tree): Define an alias to `dired-in-this-tree-p'. (dired-buffers-for-dir) * lisp/dired-aux.el (dired-tree-down, dired-kill-tree) (dired-insert-subdir, dired-rename-subdir): Update all callers (bug#32892).
-rw-r--r--lisp/dired-aux.el12
-rw-r--r--lisp/dired.el6
2 files changed, 10 insertions, 8 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index d83e57d58dc..6a1ebcced91 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1646,7 +1646,7 @@ If `ask', ask for user confirmation."
1646 (while blist 1646 (while blist
1647 (with-current-buffer (car blist) 1647 (with-current-buffer (car blist)
1648 (if (and buffer-file-name 1648 (if (and buffer-file-name
1649 (dired-in-this-tree buffer-file-name expanded-from-dir)) 1649 (dired-in-this-tree-p buffer-file-name expanded-from-dir))
1650 (let ((modflag (buffer-modified-p)) 1650 (let ((modflag (buffer-modified-p))
1651 (to-file (dired-replace-in-string 1651 (to-file (dired-replace-in-string
1652 (concat "^" (regexp-quote from-dir)) 1652 (concat "^" (regexp-quote from-dir))
@@ -1665,7 +1665,7 @@ If `ask', ask for user confirmation."
1665 (while alist 1665 (while alist
1666 (setq elt (car alist) 1666 (setq elt (car alist)
1667 alist (cdr alist)) 1667 alist (cdr alist))
1668 (if (dired-in-this-tree (car elt) expanded-dir) 1668 (if (dired-in-this-tree-p (car elt) expanded-dir)
1669 ;; ELT's subdir is affected by the rename 1669 ;; ELT's subdir is affected by the rename
1670 (dired-rename-subdir-2 elt dir to))) 1670 (dired-rename-subdir-2 elt dir to)))
1671 (if (equal dir default-directory) 1671 (if (equal dir default-directory)
@@ -2420,7 +2420,7 @@ This function takes some pains to conform to `ls -lR' output."
2420 (setq switches (dired-replace-in-string "R" "" switches)) 2420 (setq switches (dired-replace-in-string "R" "" switches))
2421 (dolist (cur-ass dired-subdir-alist) 2421 (dolist (cur-ass dired-subdir-alist)
2422 (let ((cur-dir (car cur-ass))) 2422 (let ((cur-dir (car cur-ass)))
2423 (and (dired-in-this-tree cur-dir dirname) 2423 (and (dired-in-this-tree-p cur-dir dirname)
2424 (let ((cur-cons (assoc-string cur-dir dired-switches-alist))) 2424 (let ((cur-cons (assoc-string cur-dir dired-switches-alist)))
2425 (if cur-cons 2425 (if cur-cons
2426 (setcdr cur-cons switches) 2426 (setcdr cur-cons switches)
@@ -2432,7 +2432,7 @@ This function takes some pains to conform to `ls -lR' output."
2432(defun dired-insert-subdir-validate (dirname &optional switches) 2432(defun dired-insert-subdir-validate (dirname &optional switches)
2433 ;; Check that it is valid to insert DIRNAME with SWITCHES. 2433 ;; Check that it is valid to insert DIRNAME with SWITCHES.
2434 ;; Signal an error if invalid (e.g. user typed `i' on `..'). 2434 ;; Signal an error if invalid (e.g. user typed `i' on `..').
2435 (or (dired-in-this-tree dirname (expand-file-name default-directory)) 2435 (or (dired-in-this-tree-p dirname (expand-file-name default-directory))
2436 (error "%s: not in this directory tree" dirname)) 2436 (error "%s: not in this directory tree" dirname))
2437 (let ((real-switches (or switches dired-subdir-switches))) 2437 (let ((real-switches (or switches dired-subdir-switches)))
2438 (when real-switches 2438 (when real-switches
@@ -2473,7 +2473,7 @@ of marked files. If KILL-ROOT is non-nil, kill DIRNAME as well."
2473 (setq dir (car (car s-alist)) 2473 (setq dir (car (car s-alist))
2474 s-alist (cdr s-alist)) 2474 s-alist (cdr s-alist))
2475 (and (or kill-root (not (string-equal dir dirname))) 2475 (and (or kill-root (not (string-equal dir dirname)))
2476 (dired-in-this-tree dir dirname) 2476 (dired-in-this-tree-p dir dirname)
2477 (dired-goto-subdir dir) 2477 (dired-goto-subdir dir)
2478 (setq m-alist (nconc (dired-kill-subdir remember-marks) m-alist)))) 2478 (setq m-alist (nconc (dired-kill-subdir remember-marks) m-alist))))
2479 m-alist)) 2479 m-alist))
@@ -2711,7 +2711,7 @@ Lower levels are unaffected."
2711 (while rest 2711 (while rest
2712 (setq elt (car rest) 2712 (setq elt (car rest)
2713 rest (cdr rest)) 2713 rest (cdr rest))
2714 (if (dired-in-this-tree (directory-file-name (car elt)) dir) 2714 (if (dired-in-this-tree-p (directory-file-name (car elt)) dir)
2715 (setq rest nil 2715 (setq rest nil
2716 pos (dired-goto-subdir (car elt)))))) 2716 pos (dired-goto-subdir (car elt))))))
2717 (if pos 2717 (if pos
diff --git a/lisp/dired.el b/lisp/dired.el
index 38ba3734a61..c455a5cde46 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2697,7 +2697,7 @@ You can then feed the file name(s) to other commands with \\[yank]."
2697 ((null (buffer-name buf)) 2697 ((null (buffer-name buf))
2698 ;; Buffer is killed - clean up: 2698 ;; Buffer is killed - clean up:
2699 (setq dired-buffers (delq elt dired-buffers))) 2699 (setq dired-buffers (delq elt dired-buffers)))
2700 ((dired-in-this-tree dir (car elt)) 2700 ((dired-in-this-tree-p dir (car elt))
2701 (with-current-buffer buf 2701 (with-current-buffer buf
2702 (and (assoc dir dired-subdir-alist) 2702 (and (assoc dir dired-subdir-alist)
2703 (or (null file) 2703 (or (null file)
@@ -2770,10 +2770,12 @@ You can then feed the file name(s) to other commands with \\[yank]."
2770 2770
2771;;; utility functions 2771;;; utility functions
2772 2772
2773(defun dired-in-this-tree (file dir) 2773(defun dired-in-this-tree-p (file dir)
2774 ;;"Is FILE part of the directory tree starting at DIR?" 2774 ;;"Is FILE part of the directory tree starting at DIR?"
2775 (let (case-fold-search) 2775 (let (case-fold-search)
2776 (string-match-p (concat "^" (regexp-quote dir)) file))) 2776 (string-match-p (concat "^" (regexp-quote dir)) file)))
2777(define-obsolete-function-alias 'dired-in-this-tree
2778 'dired-in-this-tree-p "27.1")
2777 2779
2778(defun dired-normalize-subdir (dir) 2780(defun dired-normalize-subdir (dir)
2779 ;; Prepend default-directory to DIR if relative file name. 2781 ;; Prepend default-directory to DIR if relative file name.