From: Tino Calancha <tino.calancha@gmail.com>
To: 32892@debbugs.gnu.org
Subject: bug#32892: 27.0.50; End predicate `dired-in-this-tree' with '-p'
Date: Mon, 1 Oct 2018 20:09:46 +0900 [thread overview]
Message-ID: <CAFgA-y01ZMgD8Kgi5PQ78DxXTjnQ=T1DpnEmQz9F4bXCC2kpaA@mail.gmail.com> (raw)
Severity: wishlist
`dired-in-this-tree' is used as a predicate elsewhere.
I suggest to follow the convention on predicates, i.e., to end
its name with '-p'.
--8<-----------------------------cut here---------------start------------->8---
commit 278c6d78c7d27eeb9bba19c5781cc43a5809a0ad
Author: Tino Calancha <tino.calancha@gmail.com>
Date: Mon Oct 1 19:59:24 2018 +0900
End predicate `dired-in-this-tree' with '-p'
Rename `dired-in-this-tree-p' from `dired-in-this-tree'.
* 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): Change comment into docstring.
(dired-buffers-for-dir)
* lisp/dired-aux.el (dired-tree-down, dired-kill-tree)
(dired-insert-subdir, dired-rename-subdir): Update all callers.
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 1f13204b7c..9925615202 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1622,7 +1622,7 @@ dired-rename-subdir
(while blist
(with-current-buffer (car blist)
(if (and buffer-file-name
- (dired-in-this-tree buffer-file-name expanded-from-dir))
+ (dired-in-this-tree-p buffer-file-name expanded-from-dir))
(let ((modflag (buffer-modified-p))
(to-file (dired-replace-in-string
(concat "^" (regexp-quote from-dir))
@@ -1641,7 +1641,7 @@ dired-rename-subdir-1
(while alist
(setq elt (car alist)
alist (cdr alist))
- (if (dired-in-this-tree (car elt) expanded-dir)
+ (if (dired-in-this-tree-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)
@@ -2392,7 +2392,7 @@ dired-insert-subdir
(setq switches (dired-replace-in-string "R" "" switches))
(dolist (cur-ass dired-subdir-alist)
(let ((cur-dir (car cur-ass)))
- (and (dired-in-this-tree cur-dir dirname)
+ (and (dired-in-this-tree-p cur-dir dirname)
(let ((cur-cons (assoc-string cur-dir dired-switches-alist)))
(if cur-cons
(setcdr cur-cons switches)
@@ -2404,7 +2404,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 dirname (expand-file-name default-directory))
+ (or (dired-in-this-tree-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
@@ -2445,7 +2445,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 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))
@@ -2683,7 +2683,7 @@ dired-tree-down
(while rest
(setq elt (car rest)
rest (cdr rest))
- (if (dired-in-this-tree (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
diff --git a/lisp/dired.el b/lisp/dired.el
index 5c7bb9599c..63d8d4f52c 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2607,12 +2607,12 @@ dired-copy-filename-as-kill
;; Keeping Dired buffers in sync with the filesystem and with each other
(defun dired-buffers-for-dir (dir &optional file)
-;; Return a list of buffers for DIR (top level or in-situ subdir).
-;; If FILE is non-nil, include only those whose wildcard pattern (if any)
-;; matches FILE.
-;; 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.
+ "Return a list of buffers for DIR (top level or in-situ subdir).
+If FILE is non-nil, include only those whose wildcard pattern (if any)
+matches FILE.
+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))
(let (result buf)
(dolist (elt dired-buffers)
@@ -2621,7 +2621,7 @@ dired-buffers-for-dir
((null (buffer-name buf))
;; Buffer is killed - clean up:
(setq dired-buffers (delq elt dired-buffers)))
- ((dired-in-this-tree dir (car elt))
+ ((dired-in-this-tree-p dir (car elt))
(with-current-buffer buf
(and (assoc dir dired-subdir-alist)
(or (null file)
@@ -2694,11 +2694,13 @@ dired-unadvertise
;;; utility functions
-(defun dired-in-this-tree (file dir)
- ;;"Is FILE part of the directory tree starting at DIR?"
+(defun dired-in-this-tree-p (file dir)
+ "Return non-nil if FILE belongs to the directory tree starting at DIR."
(let (case-fold-search)
(string-match-p (concat "^" (regexp-quote dir)) file)))
+(defalias 'dired-in-this-tree 'dired-in-this-tree-p)
+
(defun dired-normalize-subdir (dir)
;; Prepend default-directory to DIR if relative file name.
;; dired-get-filename must be able to make a valid file name from a
--8<-----------------------------cut here---------------end--------------->8---
In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
of 2018-08-20 built on calancha-pc.dy.bbexcite.jp
Repository revision: 6217746dd64b43a2a2b3b66ab50cfbbfc984f36c
next reply other threads:[~2018-10-01 11:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-01 11:09 Tino Calancha [this message]
2019-07-13 2:04 ` bug#32892: 27.0.50; End predicate `dired-in-this-tree' with '-p' Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFgA-y01ZMgD8Kgi5PQ78DxXTjnQ=T1DpnEmQz9F4bXCC2kpaA@mail.gmail.com' \
--to=tino.calancha@gmail.com \
--cc=32892@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.