From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#32892: 27.0.50; End predicate `dired-in-this-tree' with '-p' Date: Mon, 1 Oct 2018 20:09:46 +0900 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1538392090 3075 195.159.176.226 (1 Oct 2018 11:08:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 1 Oct 2018 11:08:10 +0000 (UTC) To: 32892@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 01 13:08:06 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g6w3Y-0000gZ-Fq for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Oct 2018 13:08:04 +0200 Original-Received: from localhost ([::1]:37484 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6w5e-0006l2-Tj for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Oct 2018 07:10:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51582) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6w5Y-0006ks-KG for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2018 07:10:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6w5S-0003vN-Lt for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2018 07:10:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56507) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g6w5S-0003vF-HO for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2018 07:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g6w5S-0001vh-Bg for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2018 07:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Oct 2018 11:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 32892 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15383922007402 (code B ref -1); Mon, 01 Oct 2018 11:10:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Oct 2018 11:10:00 +0000 Original-Received: from localhost ([127.0.0.1]:60765 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g6w5Q-0001vK-BH for submit@debbugs.gnu.org; Mon, 01 Oct 2018 07:10:00 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41920) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g6w5N-0001v3-NY for submit@debbugs.gnu.org; Mon, 01 Oct 2018 07:09:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6w5H-0003qH-KA for submit@debbugs.gnu.org; Mon, 01 Oct 2018 07:09:52 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:43365) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g6w5H-0003q8-Er for submit@debbugs.gnu.org; Mon, 01 Oct 2018 07:09:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51524) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6w5G-0006kU-A6 for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2018 07:09:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6w5F-0003mm-2i for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2018 07:09:50 -0400 Original-Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]:37883) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g6w5E-0003mV-T5 for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2018 07:09:49 -0400 Original-Received: by mail-oi1-x235.google.com with SMTP id e17-v6so9922604oib.4 for ; Mon, 01 Oct 2018 04:09:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=7Thz55IKoEmWh6YyaOnveCjOjYeqAzFOFagdwg20a4A=; b=smJaZbC4CMbIyQN4GsT11YpLFrZhjrJyDYTtQ7nN8hJAW/ZulV1edUsborOFQc7UGq kA6uF05754YYzukL2VFT1oxkWQ0zLwC+14QuUH1ZbQZOgS46q0KyubZ6C/DeiQ9HW/TL zsRTPKWNjaCfvWs41ZNUR/ZRAq158cyUEKZQBtTzFUR4LC/Q01pt4q6d0VF/f6cHg9EF aFvDmNji8+rFTvMzv5j/fyCdT05b6r4E8OOMdaTQT3lC6b6RCTYatMyVrdyil2MoZKUM FUEE9nXaI+rfI6FpoFS9Mv/UE1l2aW/wld9ucsJy96D9NMMXd97bdKs19hQZGIZ9k3m0 uT0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=7Thz55IKoEmWh6YyaOnveCjOjYeqAzFOFagdwg20a4A=; b=liVEIgaIUXbo3dMmhy9zn7f9tucG8FZ3dpcMvTNtUYaY4NsZRRrstHX4AERa13bJM/ 3U0/W5XBZX+fVz/xzCZdkcjwucvmkTYvxzuTDwltY8aK9eCFmD2GekrnpTeG7zSShh+p zplTjx+QQ62TEfw318NuHGP4tv0DfDfSXbgRGonUrlVCTtrcnIT9alFbtiwYkIeGhC7/ FCDoZTUMVo6ri9MCGNW8+qPBVx6uLwC44kO7P3sW///dOqk53hMx/8FSg6HKwWZN1gSg oDtR782krxz4fu9XhkBLbY8pQWwePisj25TDr28dCog9Yfkx/Cv++DI61MeDD1H03xgN L3zQ== X-Gm-Message-State: ABuFfohMsIjFA53orH26XUtq9+3xEQ2Ofh0Dod5uDxbONY986WJXbPEu XbWKD3zl4IPmmZJfAkoA0e4YvAr+mJIcStS35hN0g5U6 X-Google-Smtp-Source: ACcGV60PfjVg5OBhDHHvC0du92SYFEeB5J0skBzcvbfkvcsISRFy36TjSvx+b40MsGAFnTIf1FOtuP21kM9JKjYcjhs= X-Received: by 2002:aca:db05:: with SMTP id s5-v6mr5194668oig.173.1538392187346; Mon, 01 Oct 2018 04:09:47 -0700 (PDT) Original-Received: by 2002:a4a:8a45:0:0:0:0:0 with HTTP; Mon, 1 Oct 2018 04:09:46 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:150865 Archived-At: 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 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