GNU bug report logs - #32892
27.0.50; End predicate `dired-in-this-tree' with '-p'

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Mon, 1 Oct 2018 11:10:02 UTC

Severity: wishlist

Tags: fixed

Found in version 27.0.50

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32892 in the body.
You can then email your comments to 32892 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#32892; Package emacs. (Mon, 01 Oct 2018 11:10:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tino Calancha <tino.calancha <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 01 Oct 2018 11:10:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; End predicate `dired-in-this-tree' with '-p'
Date: Mon, 1 Oct 2018 20:09:46 +0900
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 <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32892; Package emacs. (Sat, 13 Jul 2019 02:05:01 GMT) Full text and rfc822 format available.

Message #8 received at 32892 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 32892 <at> debbugs.gnu.org
Subject: Re: bug#32892: 27.0.50; End predicate `dired-in-this-tree' with '-p'
Date: Sat, 13 Jul 2019 04:04:21 +0200
Tino Calancha <tino.calancha <at> gmail.com> writes:

> `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'.

Makes sense; I've now applied it to the trunk.

>     (dired-buffers-for-dir): Change comment into docstring.

Except this bit, which seemed unrelated.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 13 Jul 2019 02:05:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 32892 <at> debbugs.gnu.org and Tino Calancha <tino.calancha <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 13 Jul 2019 02:05:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 10 Aug 2019 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 261 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.