From unknown Tue Jun 17 22:29:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#58364: [PATCH] Add new function 'file-name-parent-p' Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 07 Oct 2022 20:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58364 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 58364@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16651742163752 (code B ref -1); Fri, 07 Oct 2022 20:24:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 Oct 2022 20:23:36 +0000 Received: from localhost ([127.0.0.1]:37499 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ogtse-0000yS-8v for submit@debbugs.gnu.org; Fri, 07 Oct 2022 16:23:36 -0400 Received: from lists.gnu.org ([209.51.188.17]:43832) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ogtsc-0000yH-JF for submit@debbugs.gnu.org; Fri, 07 Oct 2022 16:23:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogtsc-0001lu-EP for bug-gnu-emacs@gnu.org; Fri, 07 Oct 2022 16:23:34 -0400 Received: from mout02.posteo.de ([185.67.36.66]:35793) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogtsa-0007Sx-HY for bug-gnu-emacs@gnu.org; Fri, 07 Oct 2022 16:23:34 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id F3BB2240103 for ; Fri, 7 Oct 2022 22:23:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1665174209; bh=H/NHws3jP8j5PE3VUaGf48fLJspIH8gqkRJRVcpdWqc=; h=From:To:Subject:Autocrypt:Date:From; b=qnoz0GAWQ/xfysv4UQtGBqw1K+yS8mtkbBhQyeg1tDk/6bwUbE8bR7br/5q16/gKk rIUZhLZuuN/xjNGxTcmSby4DD9PpFIX5X4JsLSwSobSPg3fBgVZ10B7tGZhRqyt04g 37WLcP7D9LuXfuxi2HqmIgvuZGWJb8qtyVutiko/Uu8kEowxcasEIr7GW4FEUg2WP9 FD3Gv7AMsA7mBUluJZLU4CgDm7+NyRn+YY39oYtI97WDpz/vxszLftioffjGoTa8mm z6tGVa+TDAt3cSTNyXIw+nlniiOUAi5mb3tAjOYLf7A9tJY7cFhsgf/l1554hNXAqQ ta0C53ufSqRew== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Mkfrw3qwNz9rxH for ; Fri, 7 Oct 2022 22:23:28 +0200 (CEST) From: Philip Kaludercic Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB Date: Fri, 07 Oct 2022 20:23:27 +0000 Message-ID: <87h70f758g.fsf@posteo.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain Tags: patch Unless I am mistaken, there is no direct function to quickly test if a directory is a super-directory of file. As I have encountered this issue more than once the last few days of hacking, I would like to propose the below function. In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6) of 2022-10-07 built on rhea Repository revision: 51f5a7cf127934aa93d860c8fd3e8d58fbc594cb Repository branch: feature/package+vc System Description: Fedora Linux 36 (Workstation Edition) Configured using: 'configure --with-pgtk --with-imagemagick' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Add-new-function-file-name-parent-p.patch >From 87ca79778f3220c80826257d2b67e405940a9b11 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Fri, 7 Oct 2022 22:20:30 +0200 Subject: [PATCH] Add new function 'file-name-parent-p' * doc/lispref/files.texi (Directory Names): Explain it. * etc/NEWS: Mention in. * lisp/files.el (file-name-parent-p): Add it. --- doc/lispref/files.texi | 5 +++++ etc/NEWS | 4 ++++ lisp/files.el | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index e1aa2de523..30cc950ad2 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -2454,6 +2454,11 @@ Directory Names non-@code{nil}, it ends in a slash. @end defun +@defun file-name-parent-p directory filename +This function will return a non-@code{nil} value if @var{directory} is +a parent directory of @var{filename}. +@end defun + @node File Name Expansion @subsection Functions that Expand Filenames @cindex expansion of file names diff --git a/etc/NEWS b/etc/NEWS index 68cd8bd906..c02ff2ecb5 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3675,6 +3675,10 @@ This returns a list of all the components of a file name. ** New function 'file-name-parent-directory'. This returns the parent directory of a file name. ++++ +** New function 'file-name-parent-p'. +This checks if a directory is an eventual parent of a file. + +++ ** New macro 'with-undo-amalgamate'. It records a particular sequence of operations as a single undo step. diff --git a/lisp/files.el b/lisp/files.el index 43c5d7d1da..1a670b25a9 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -5220,6 +5220,11 @@ file-name-parent-directory (t parent)))) +(defun file-name-parent-p (dir file) + "Return non-nil if DIR is a parent-directory of FILE." + (and (locate-dominating-file file (apply-partially #'file-equal-p dir)) + t)) + (defcustom make-backup-file-name-function #'make-backup-file-name--default-function "A function that `make-backup-file-name' uses to create backup file names. -- 2.37.3 --=-=-=-- From unknown Tue Jun 17 22:29:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#58364: Acknowledgement ([PATCH] Add new function 'file-name-parent-p') Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 07 Oct 2022 20:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58364 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 58364@debbugs.gnu.org X-Debbugs-Original-To: help-debbugs@gnu.org (GNU bug Tracking System) X-Debbugs-Original-Cc: 58364@debbugs.gnu.org Received: via spool by 58364-submit@debbugs.gnu.org id=B58364.166517558514253 (code B ref 58364); Fri, 07 Oct 2022 20:47:02 +0000 Received: (at 58364) by debbugs.gnu.org; 7 Oct 2022 20:46:25 +0000 Received: from localhost ([127.0.0.1]:37509 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oguEi-0003hp-Q2 for submit@debbugs.gnu.org; Fri, 07 Oct 2022 16:46:25 -0400 Received: from mout02.posteo.de ([185.67.36.66]:46337) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oguEh-0003hZ-9E for 58364@debbugs.gnu.org; Fri, 07 Oct 2022 16:46:23 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 214FE240101 for <58364@debbugs.gnu.org>; Fri, 7 Oct 2022 22:46:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1665175577; bh=DnpkuPZQh5dLiu9kRPno+xJ1F2MwHuv6csmeCXWE6vE=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=Yj8ds3AscP5RrMe1uUf2/mZk+waMRFhEJXUllhfNbKImw0oXjd+ZsqIylVZhsg0A6 xgLaO2HfCN361LdeHWk4W5XnZz+PsmguG1Aep5GFS3yildmAF5ZBQ2hqaq4rHb/ynj 5dmIGlxfkI26D84VLyHTj+/iVVWzdRuqSpPGucINiUFfMtr7aa2PV7ygeCcIy+Jhy3 Y9KTUDv57NsI1jrs4WaKPfh1x9kkX0qbe7oki1nSPvfYApFdRclkrE4MB4LHkPGSKn 5sHVLRpmU286rkzEUE3uZWnQNV7txbh556TPx37fRo/vbmNu90tEZc6v6mqMfWGLqH ORZCwbUAMNzdw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4MkgMD3Mypz6tn5; Fri, 7 Oct 2022 22:46:13 +0200 (CEST) From: Philip Kaludercic In-Reply-To: (GNU bug Tracking System's message of "Fri, 07 Oct 2022 20:24:02 +0000") References: <87h70f758g.fsf@posteo.net> Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB Date: Fri, 07 Oct 2022 20:46:13 +0000 Message-ID: <87bkqn746i.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) I have found at least two edge-cases with the current implementation that don't work as one would expect them to: - (file-name-parent-p "/etc/passwd" "/etc/passwd") => t - (file-name-parent-p "." "/") => t From unknown Tue Jun 17 22:29:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#58364: [PATCH] Add new function 'file-name-parent-p' Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 07 Oct 2022 21:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58364 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Philip Kaludercic , "58364@debbugs.gnu.org" <58364@debbugs.gnu.org> Received: via spool by 58364-submit@debbugs.gnu.org id=B58364.166517704425302 (code B ref 58364); Fri, 07 Oct 2022 21:11:01 +0000 Received: (at 58364) by debbugs.gnu.org; 7 Oct 2022 21:10:44 +0000 Received: from localhost ([127.0.0.1]:37578 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ogucF-0006a2-Px for submit@debbugs.gnu.org; Fri, 07 Oct 2022 17:10:44 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:24086) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ogucB-0006Zr-Pg for 58364@debbugs.gnu.org; Fri, 07 Oct 2022 17:10:42 -0400 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 297HwjJ5012804; Fri, 7 Oct 2022 21:10:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2022-7-12; bh=Qq1/6MCeWj0BeUNhXgQXQRL6KrdZDVsx98B54S9wZPY=; b=FHmabcyu2K9+8C9xjSZ8FySZZKecxlmH3MvPveluR525cuNDc6p1oE6SHh6szDRZxM9U UvlkLp4efgNZeJhhL6jHV8gUPEwr4IRw0WJZFGDE6ktQxXdhGDeaUJ9q5q+69RusXdqT FX7PzJvBJIhCqdFJoONkb5c4JN5AA2jkfwKmMBQdc0wZ/dQOX5MWXIitD8kSO03W9sXe eOXwPchgNpj1CIUh2myZ1ok+2Z4Aj24ydvxb8otB+YxoO+bZVO8faqEpv/JFzAw0MIiZ RS+yjzTaDy1uwS48dHYveULbQfye0P0fvLtgDqVh3PIL+vpdIdVDUIeZG0XrzkbzAq3S 9w== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jxc528kq1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 07 Oct 2022 21:10:38 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 297JOmS0002726; Fri, 7 Oct 2022 21:10:37 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2106.outbound.protection.outlook.com [104.47.70.106]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3jxc0dhfrc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 07 Oct 2022 21:10:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dhiPwK2Nssr6Q6/WWIp/cJo2cxUI8T4jg2pcqsDLn3V96yAkrkzE/o2wWgZds2ENsYY71zVxt+sxflcM6rWXVJN5S1ROvN3Ta8QV8B72v3WV5wUbOl3OObq0tuakTh/qZh12DaKSX4qDHZCp8U+Mv5LHuCKCF/TksZluuQkJnM4Emgu1NtT+/wUQPGapGH7Mq8LwbENVxjVH188OYEudAngOZ3Ha8wvVV0LtODSQgOIl3v74GT9ZhM/C6mtd/tv/Lk/MO8wfaJIRRfxIu2+EdpLuVA3JBRbhroaMR4mLGIhtqk9NcRS7wfxXw3M9cJQ5ixivkMgsHpbmtSuYU3cDAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Qq1/6MCeWj0BeUNhXgQXQRL6KrdZDVsx98B54S9wZPY=; b=oATEpzIcwHAtSau8myG/sa7FNCz1l87dgwIIDPZtl4ahAJOheP6AorobvuWSamnhFIo3wx/xZlGFLqrHBGaJCMHSO92ffG5BgAj8tCXF30SxnzOdQsKeTQm2JvIi2W+k9uY2g87IRjT7wKQzSAv7h90b0TvTCYKUKozdjS8GjJtowVqex5SCMX2hbcGqzemaLRzuvcBKqHWSDXW0yVfLk9wHLgbyPTSTiMTFWiGWBESfTTkyrkPu2KXh7KQPy9NxTOGbpfuD0SJlbBJUrCnvQ0aq3HXkSopiJj95BzCKu2jLufUfIEIro9FpKyTO6S1smAianfc8wKFP+uN6ioXRDg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Qq1/6MCeWj0BeUNhXgQXQRL6KrdZDVsx98B54S9wZPY=; b=dshe9OBgqznTJ7MB5AzF4IjZ5EaStxkZSvKEartY9CiOHUSoe1xmgwC44Zfj3YKDquB298IQDFsAiYIK6B5gDqHVaF89UOyT6pGRmAY8tkfXdqI34YX9xuK64d431QUzbF9ty7RzIpjo4Tf4MfH6UfOMxSpmr7+IOT7aROl68q4= Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19) by DM6PR10MB4332.namprd10.prod.outlook.com (2603:10b6:5:220::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15; Fri, 7 Oct 2022 21:10:35 +0000 Received: from SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::f319:dced:1a48:779a]) by SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::f319:dced:1a48:779a%4]) with mapi id 15.20.5676.036; Fri, 7 Oct 2022 21:10:35 +0000 From: Drew Adams Thread-Topic: [External] : bug#58364: [PATCH] Add new function 'file-name-parent-p' Thread-Index: AQHY2orEvK7ss9Du9USJJbESswc7wa4DaGQQ Date: Fri, 7 Oct 2022 21:10:35 +0000 Message-ID: References: <87h70f758g.fsf@posteo.net> In-Reply-To: <87h70f758g.fsf@posteo.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SJ0PR10MB5488:EE_|DM6PR10MB4332:EE_ x-ms-office365-filtering-correlation-id: 18ba7104-ce77-477f-8253-08daa8a8607a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 43/1B3cHGjRXvq/SW22m5UoY+Q48DsaxV7ZviqJxwVkZq/jjH5I0oKpChWZVzR2GU4Ax8n8ws/bsNbdkqPeUDcH0BZteX5q0bRcUkD0/pT7ZGlx/LapD4xfW9QYjDl/4D/Pvkfgxvn5x8VbGJMfUrqVUKWQH3moByk4M50MPLXa+9SYDWC91M4wSM4jHTmGc0Pl2P9OswikQZILfiQKHjaEX0AfmRsJ6nQwQ3n0jr/YOhTUo+R9jA9ydg20BlaFp+qfX4Puzacl09mtKfwkqv/pogQI/W5mzrgHI7+/8mDWwVJnm7T1KjLejp6iZIbUm8bgPB5PkJ/8HIhZH+KoT6YJJio73N1yHcEbWb9dGT2N8pQjtcthGAl3zYi3fJ1zZUWPkYDHUJJHoROGmV02Xq+mcyJlH4LXwaWqoq9+KAAguzjEewB8uzASlfPQw9xLI9i+gUnjcurQUEzhY2rBu/c2hGbIh7rpJA+PJhsecijGGy6DT+23Lh7Hkfd5bkwIekZpLKYzBpXDKh41YULdHp3z0JrIoO9BgZDE7xtHKcK00LW+NTbCzC7roXK+3GGKEgsm0/tdI0QyxxzrGUur1kwidRsR+3XX0YOxMTI6RdVViL4rWqmRdjf3AFtnHZyoHMcfOpRkrSTbhAHC4enPQYctjx6Ia4Nz/sa2FUIO3p1yUgaU2a/h4ACaPmdYdV1bZXZnTFSVPqBGkyX/8KZDI/ochlyDO1TJMAmGxPc5LqBo0cKumLvW0H6boJ4b9aYGrQxodNQ9y1hL9MxW6r+UaLA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR10MB5488.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(39860400002)(346002)(136003)(366004)(376002)(396003)(451199015)(186003)(38070700005)(122000001)(38100700002)(5660300002)(44832011)(41300700001)(2906002)(8936002)(52536014)(55016003)(478600001)(9686003)(26005)(8676002)(66556008)(66476007)(64756008)(316002)(66946007)(6506007)(66446008)(7696005)(76116006)(71200400001)(110136005)(33656002)(86362001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: k9v6cuRLHsuDopV17xy58uWXjYv5sKlJ4G3HMizgkgdQ6INNF2HU0pa+ZPx3Q6U2js0/DVEUy25h33qAqKvnVYYvVY+zgBKik9FZiNvOodp8cDro385uLddzan72uaxWrJUjD8q55ZgW93ttYWW/VLyEQyNSb06DCOQWfxyTxG/d84VIWFCE/UbYm5BxkHfNaXtWORGtuNQw6CjTTUUntpbxJJCfywRad5UCmj9gfI7bfW526jnijDOc1nXUcH3KDYhJjN85CCcIpmHR3jFR/RBFPQuIo9N2WEc9D4PPOqiPWiRA3WkQOz6XrtyE8nlOJ62oHXt7lSHosrEKcd4FTtKJ0qchgI/X22iqJkNPHDv/532bwFhAM70qbPhWOZRO5lWzRzKr6dHtn0kzmdpZ0nfqyw9UV9xGrbVbOMorwltSAQzCkScBmtZXX2muAnMlv9GmaJdMh2xiZelVq9h9CI3dW7NliDz1KcYi7GUpis4cqbt7nS7dXpUlQ3dVvGWSnRvM+90fpO356xWMK9Q+uwkOwE8Eml0+L+LlC2knnP5pEFSLXzry/AyW1Vsftm3hXe/Up/HVXnn8SSyIDCFgAPJctyQoHthcSPYLTgXxK5pwPXGgrGXgPYhoDol4CGBw5MUftzma1HM9SeDP+8H7S6FDomGv3Hg1B1hDiXuXDlzk/HBtluoLtHfPjYa3ic3zx64R+KCbPTFyjpB9GJ6TSjCqo8dfG4UykwYekQC77mS1FLkww6DCHikQdokiE2guJkwU2l739+uzvFoel2EB8Axm7x8FyQxg1CeIEynMinCnmDUD/JAyUOvLhO+Ya1zh4nbklLZWCwaEtwBqFUfPrNzncofSeVYrwFX8Jvn3jOgKYf8oj6iVodFEVo386KjKGlKN1gqb1QETowhREyusw++YqyQ2NzkiXwjkndPNOv1HoyjvAdqguIR+CGEatHI/BjikAtlPpugtN3wLkGoZ74sgc9fmz+FmV1nncj0LEHImpR6Iw/cbmyVtg4ooL9tm4iJ6zT04GfaMGanWydXM6bj3YrXyOIpn8IdYIMmPojmNgkUVya+LVPDdnUDrcFHDHf4q/PuZEzgiByIEP99N3VyRI/4cbyf2vRhJAuawqPUQ0cL+f/PmMfblUFzxo3TnDf9FR8cNgFuWN51PKnCyAffBGHSVZNq9W3jM43GwLUvn/7Th3WxipTkkKgRD8ygxy2sA8RCFgB9LFJiwFWZ2l9HYoHVNDXbeH05ltfzOqdWS3wf6fdyexOqu4CyiHcC4LQnXgHav+ycbAS/po/VtNcnA/zdcJQJtnp4Lrc8hVaQNWVx03FAnz1mj0aCLLwCBST1YuHqvnDKfkpbCN5Z44RKmJXQB8pmYwk6xXmoxRplCxXvLRGyTXtsvV714Pn/PbeQYX7OdTPTM1cJN13QgnRkl1vQMaVW985bKhcawWk0mr5pQobw2szXLRuFvGv6JF5qLlfVhYpJKUDlcjb3PLUh7MgrKnU73V0+yaFHvn4LOI4BTBQsq1LULl3gQVpkJpAi7QPSncV3uSyWltsf0+sq47u8nNaBEF8AyFNkrmm1PviVjTiz+tiIad/4j+/FO Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5488.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 18ba7104-ce77-477f-8253-08daa8a8607a X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Oct 2022 21:10:35.2491 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: QwWRQmyPsJvvLFKOySlIhsQeeM3mWGLNMu2yCFdHHXNZKuwY7e0o/EXz7Hn2/A7xaH1hb9thMdtjsHCr06TdNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4332 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-10-07_04,2022-10-07_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 mlxscore=0 malwarescore=0 adultscore=0 spamscore=0 mlxlogscore=967 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210070126 X-Proofpoint-GUID: 7xfSUQuiPGSBl8HTM2rIgXdqP1TfY_mn X-Proofpoint-ORIG-GUID: 7xfSUQuiPGSBl8HTM2rIgXdqP1TfY_mn X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > Unless I am mistaken, there is no direct function > to quickly test if a directory is a super-directory > of file. As I have encountered this issue more > than once the last few days of hacking, I would > like to propose the below function. Parent is not the same as super-directory (or "eventual parent", as your doc says). A parent is an immediate direct ancestor. It's not just _any_ ancestor. "Ancestor" includes parent, grandparent,... -- any level. I guess it's what you meant by "parent" and "super-directory". ___ FWIW: I use this, for a _parent_ directory. (I've likely proposed this to Emacs before.) The name is because it's defined in dired+.el, but the function isn't specific to Dired. (defun diredp-parent-dir (file &optional relativep) "Return the parent directory of FILE, or nil if none. Optional arg RELATIVEP non-nil means return a relative name, that is, just the parent component." (let ((parent (file-name-directory (directory-file-name (expand-file-name file)))) relparent) (when relativep (setq relparent (file-name-nondirectory (directory-file-name parent)))) (and (not (equal parent file)) (or relparent parent)))) IOW, in a nutshell, this is a parent dir of FILE: (file-name-directory (directory-file-name (expand-file-name FILE))) FWIW2: I use this to get a list of all ancestors of DIR. (defun diredp-ancestor-dirs (dir) "Return a list of the ancestor directories of directory DIR." (mapcar #'file-name-as-directory (diredp-maplist (lambda (dd) (mapconcat #'identity (reverse dd) "/")) (cdr (nreverse (split-string dir "/" t)))))) (You can use `cl-maplist'. I use `diredp-maplist' because dired+.el needs compatibility with old Emacs versions.) From unknown Tue Jun 17 22:29:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#58364: [PATCH] Add new function 'file-name-parent-p' Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Oct 2022 06:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58364 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Philip Kaludercic Cc: 58364@debbugs.gnu.org Received: via spool by 58364-submit@debbugs.gnu.org id=B58364.166520987022820 (code B ref 58364); Sat, 08 Oct 2022 06:18:02 +0000 Received: (at 58364) by debbugs.gnu.org; 8 Oct 2022 06:17:50 +0000 Received: from localhost ([127.0.0.1]:38050 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oh39i-0005vz-HU for submit@debbugs.gnu.org; Sat, 08 Oct 2022 02:17:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48294) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oh39g-0005vm-R0 for 58364@debbugs.gnu.org; Sat, 08 Oct 2022 02:17:49 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47612) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oh39b-0002ZW-5u; Sat, 08 Oct 2022 02:17:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=xPWJ/A3EVO8G2emVPeJ9HSXuIXUtBNl5UKhtBKQ4Br0=; b=cIYG9rSOZBi1 es7XXiCCxpFA28LbMQRe0sBR4IaFRACtFyWdjSaKr+Me5iJHhUo+bqo0s8fbo7RAmr04WW7o+J7JA r6Z1DSy2WEDmxTVGZmK9P3w1W787zNibaoR5Qn4vJsiS9x0SuD5Ed5g5dNHSqXq30X17zbhuMjMDd QSQfA1If8fyZkTNXCHi0JqEXfT0iksL5QhMWVkX7hKtTJgCCVVCqoYWfH15Xvv3Nosqe7HFzm4Qv+ RKoCLKoAWaLRSy6++fS+9ZT0co9TzszkwAezy2DFOvT6Gtbj21HbxiMbWCLgnGBf5EQKd6UNl+H4k nndylWu4Mh2NTOBMpdHufw==; Received: from [87.69.77.57] (port=3393 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oh39a-00044B-FW; Sat, 08 Oct 2022 02:17:42 -0400 Date: Sat, 08 Oct 2022 09:17:43 +0300 Message-Id: <831qrin8jc.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87h70f758g.fsf@posteo.net> (message from Philip Kaludercic on Fri, 07 Oct 2022 20:23:27 +0000) References: <87h70f758g.fsf@posteo.net> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Philip Kaludercic > Date: Fri, 07 Oct 2022 20:23:27 +0000 > > Unless I am mistaken, there is no direct function to quickly test if a > directory is a super-directory of file. As I have encountered this > issue more than once the last few days of hacking, I would like to > propose the below function. We have file-in-directory-p. Doesn't that fit the bill? From unknown Tue Jun 17 22:29:48 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Philip Kaludercic Subject: bug#58364: closed (Re: bug#58364: [PATCH] Add new function 'file-name-parent-p') Message-ID: References: <87sfjy93xe.fsf@posteo.net> <87h70f758g.fsf@posteo.net> X-Gnu-PR-Message: they-closed 58364 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 58364@debbugs.gnu.org Date: Sat, 08 Oct 2022 07:22:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1665213722-28749-1" This is a multi-part message in MIME format... ------------=_1665213722-28749-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #58364: [PATCH] Add new function 'file-name-parent-p' which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 58364@debbugs.gnu.org. --=20 58364: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D58364 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1665213722-28749-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 58364-done) by debbugs.gnu.org; 8 Oct 2022 07:21:13 +0000 Received: from localhost ([127.0.0.1]:38113 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oh492-0007Sa-QI for submit@debbugs.gnu.org; Sat, 08 Oct 2022 03:21:13 -0400 Received: from mout01.posteo.de ([185.67.36.65]:58927) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oh48z-0007SN-LW for 58364-done@debbugs.gnu.org; Sat, 08 Oct 2022 03:21:10 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 62B2D240028 for <58364-done@debbugs.gnu.org>; Sat, 8 Oct 2022 09:21:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1665213663; bh=nVUHlQgw3h7HyRy1qLWSB9MOz+ju2/YY3Ct5lmkoiVY=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=Wr8LuF8JLGa1byqzqDXTXmeZrbWXwOStLONccUExv5aQBDljalcxl4DgFBt7GtYwF NPjMq1IJ1xgw5cHWczg0PcwavJW02uXMt7A6Htvqp0/j9qxoFnMoTFcdKgvZSoUckq nAzhKK3o04VPNG1Bj0nA5vL3JqRskQUNHlj/7gHiWXBB+jX0uEX6hJF4FcmwHP5EqJ ig5Wnv16SZmp7NzcFFMh8BEpCP+dYpocZhP2jPiOqc4lseSlrkuqtYtPzSGPENuBAi LNr1ztQ0rE1O7gHtBB9EubLSPCWpneZ68vY5TYyXyXGUc9ThyHiw9SYKGyJKpHZhTz mVQMXeaFjcNNQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4MkxRf42J7z6tmN; Sat, 8 Oct 2022 09:21:02 +0200 (CEST) From: Philip Kaludercic To: Eli Zaretskii Subject: Re: bug#58364: [PATCH] Add new function 'file-name-parent-p' In-Reply-To: <831qrin8jc.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 08 Oct 2022 09:17:43 +0300") References: <87h70f758g.fsf@posteo.net> <831qrin8jc.fsf@gnu.org> Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB Date: Sat, 08 Oct 2022 07:21:01 +0000 Message-ID: <87sfjy93xe.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58364-done Cc: 58364-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: >> From: Philip Kaludercic >> Date: Fri, 07 Oct 2022 20:23:27 +0000 >> >> Unless I am mistaken, there is no direct function to quickly test if a >> directory is a super-directory of file. As I have encountered this >> issue more than once the last few days of hacking, I would like to >> propose the below function. > > We have file-in-directory-p. Doesn't that fit the bill? I hive tried it out and yes that was the function I was looking for. My apologies for the noise. ------------=_1665213722-28749-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 Oct 2022 20:23:36 +0000 Received: from localhost ([127.0.0.1]:37499 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ogtse-0000yS-8v for submit@debbugs.gnu.org; Fri, 07 Oct 2022 16:23:36 -0400 Received: from lists.gnu.org ([209.51.188.17]:43832) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ogtsc-0000yH-JF for submit@debbugs.gnu.org; Fri, 07 Oct 2022 16:23:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogtsc-0001lu-EP for bug-gnu-emacs@gnu.org; Fri, 07 Oct 2022 16:23:34 -0400 Received: from mout02.posteo.de ([185.67.36.66]:35793) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogtsa-0007Sx-HY for bug-gnu-emacs@gnu.org; Fri, 07 Oct 2022 16:23:34 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id F3BB2240103 for ; Fri, 7 Oct 2022 22:23:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1665174209; bh=H/NHws3jP8j5PE3VUaGf48fLJspIH8gqkRJRVcpdWqc=; h=From:To:Subject:Autocrypt:Date:From; b=qnoz0GAWQ/xfysv4UQtGBqw1K+yS8mtkbBhQyeg1tDk/6bwUbE8bR7br/5q16/gKk rIUZhLZuuN/xjNGxTcmSby4DD9PpFIX5X4JsLSwSobSPg3fBgVZ10B7tGZhRqyt04g 37WLcP7D9LuXfuxi2HqmIgvuZGWJb8qtyVutiko/Uu8kEowxcasEIr7GW4FEUg2WP9 FD3Gv7AMsA7mBUluJZLU4CgDm7+NyRn+YY39oYtI97WDpz/vxszLftioffjGoTa8mm z6tGVa+TDAt3cSTNyXIw+nlniiOUAi5mb3tAjOYLf7A9tJY7cFhsgf/l1554hNXAqQ ta0C53ufSqRew== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Mkfrw3qwNz9rxH for ; Fri, 7 Oct 2022 22:23:28 +0200 (CEST) From: Philip Kaludercic To: bug-gnu-emacs@gnu.org Subject: [PATCH] Add new function 'file-name-parent-p' Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB Date: Fri, 07 Oct 2022 20:23:27 +0000 Message-ID: <87h70f758g.fsf@posteo.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain Tags: patch Unless I am mistaken, there is no direct function to quickly test if a directory is a super-directory of file. As I have encountered this issue more than once the last few days of hacking, I would like to propose the below function. In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6) of 2022-10-07 built on rhea Repository revision: 51f5a7cf127934aa93d860c8fd3e8d58fbc594cb Repository branch: feature/package+vc System Description: Fedora Linux 36 (Workstation Edition) Configured using: 'configure --with-pgtk --with-imagemagick' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Add-new-function-file-name-parent-p.patch >From 87ca79778f3220c80826257d2b67e405940a9b11 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Fri, 7 Oct 2022 22:20:30 +0200 Subject: [PATCH] Add new function 'file-name-parent-p' * doc/lispref/files.texi (Directory Names): Explain it. * etc/NEWS: Mention in. * lisp/files.el (file-name-parent-p): Add it. --- doc/lispref/files.texi | 5 +++++ etc/NEWS | 4 ++++ lisp/files.el | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index e1aa2de523..30cc950ad2 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -2454,6 +2454,11 @@ Directory Names non-@code{nil}, it ends in a slash. @end defun +@defun file-name-parent-p directory filename +This function will return a non-@code{nil} value if @var{directory} is +a parent directory of @var{filename}. +@end defun + @node File Name Expansion @subsection Functions that Expand Filenames @cindex expansion of file names diff --git a/etc/NEWS b/etc/NEWS index 68cd8bd906..c02ff2ecb5 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3675,6 +3675,10 @@ This returns a list of all the components of a file name. ** New function 'file-name-parent-directory'. This returns the parent directory of a file name. ++++ +** New function 'file-name-parent-p'. +This checks if a directory is an eventual parent of a file. + +++ ** New macro 'with-undo-amalgamate'. It records a particular sequence of operations as a single undo step. diff --git a/lisp/files.el b/lisp/files.el index 43c5d7d1da..1a670b25a9 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -5220,6 +5220,11 @@ file-name-parent-directory (t parent)))) +(defun file-name-parent-p (dir file) + "Return non-nil if DIR is a parent-directory of FILE." + (and (locate-dominating-file file (apply-partially #'file-equal-p dir)) + t)) + (defcustom make-backup-file-name-function #'make-backup-file-name--default-function "A function that `make-backup-file-name' uses to create backup file names. -- 2.37.3 --=-=-=-- ------------=_1665213722-28749-1-- From unknown Tue Jun 17 22:29:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#58364: [PATCH] Add new function 'file-name-parent-p' Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Oct 2022 08:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58364 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Philip Kaludercic Cc: 58364@debbugs.gnu.org Received: via spool by 58364-submit@debbugs.gnu.org id=B58364.16652161221164 (code B ref 58364); Sat, 08 Oct 2022 08:03:02 +0000 Received: (at 58364) by debbugs.gnu.org; 8 Oct 2022 08:02:02 +0000 Received: from localhost ([127.0.0.1]:38160 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oh4mX-0000Ie-F9 for submit@debbugs.gnu.org; Sat, 08 Oct 2022 04:02:01 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60508) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oh4mV-0000IJ-ME for 58364@debbugs.gnu.org; Sat, 08 Oct 2022 04:02:00 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:43162) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oh4mQ-0007Bp-Eq; Sat, 08 Oct 2022 04:01:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=OjnKVllqxQmPmhsIGgObOnzOf3NFmzBHE07J/27Y8t0=; b=JAwRODOE9fad dUNr9vHlAUJERxkgIZ6FOfFMUU0PPZN9jdwVV9CRyXCPP/bVZteHXCNElOwL/Qx/14GOoLIGlpPr4 HUsI5VM1+Sm5Wxpq+dlZHX8PHAqXCujkWWTdQnb3SH6FF9DiII9ryTMTCZnXfJiIDt3N5VX9mjsSo D3s2MlPB1LfyP4oPR9v17o0ZQLzU+V539Yt0IjixwEUEVQPPv5Y62KTzENF1fY8w9qXa6vHPgqWu9 RyXKaWa+RPhlLsa588nvuWoYzmOLxxYkUZfpEVSlilqBlgOl4mDm/DSDt/xXINYioRFv15uVGnUJ6 XiLyEXk5ZY2QjIxXhdinzA==; Received: from [87.69.77.57] (port=2135 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oh4mP-0006QZ-Ow; Sat, 08 Oct 2022 04:01:54 -0400 Date: Sat, 08 Oct 2022 11:01:56 +0300 Message-Id: <83fsfylp57.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87sfjy93xe.fsf@posteo.net> (message from Philip Kaludercic on Sat, 08 Oct 2022 07:21:01 +0000) References: <87h70f758g.fsf@posteo.net> <831qrin8jc.fsf@gnu.org> <87sfjy93xe.fsf@posteo.net> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Philip Kaludercic > Cc: 58364-done@debbugs.gnu.org > Date: Sat, 08 Oct 2022 07:21:01 +0000 > > Eli Zaretskii writes: > > >> From: Philip Kaludercic > >> Date: Fri, 07 Oct 2022 20:23:27 +0000 > >> > >> Unless I am mistaken, there is no direct function to quickly test if a > >> directory is a super-directory of file. As I have encountered this > >> issue more than once the last few days of hacking, I would like to > >> propose the below function. > > > > We have file-in-directory-p. Doesn't that fit the bill? > > I hive tried it out and yes that was the function I was looking for. My > apologies for the noise. No need to apologize: no one can know and remember everything. I only remembered that because I recently fixed a bug in Dired which used that function. But perhaps our take from this is that file-in-directory-p is not discoverable enough? Can you describe how and where you looked for this functionality? Maybe if we know that, we could make some changes to have this function pop up in similar searches. From unknown Tue Jun 17 22:29:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#58364: [PATCH] Add new function 'file-name-parent-p' Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Oct 2022 09:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58364 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 58364@debbugs.gnu.org Received: via spool by 58364-submit@debbugs.gnu.org id=B58364.16652210329064 (code B ref 58364); Sat, 08 Oct 2022 09:24:02 +0000 Received: (at 58364) by debbugs.gnu.org; 8 Oct 2022 09:23:52 +0000 Received: from localhost ([127.0.0.1]:38246 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oh63k-0002M8-8U for submit@debbugs.gnu.org; Sat, 08 Oct 2022 05:23:52 -0400 Received: from mout02.posteo.de ([185.67.36.66]:40667) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oh63i-0002Lv-9S for 58364@debbugs.gnu.org; Sat, 08 Oct 2022 05:23:51 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 6219C24010A for <58364@debbugs.gnu.org>; Sat, 8 Oct 2022 11:23:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1665221024; bh=Ip0pBpE33Is0wA25FPq4028J9IyyzHhzT19OjBVxJCk=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=YTtfLtWDwJqZzlKrhdW4sN4prWPQoraG+CXVL/Wn7jSNkZk2PYOrjBOXXePy56717 lcI7KjjGDDIi3qSW27q+F9PYyjAglcFVqAcXOhIg24xFwkbsofPXb21//svDpno1km 6okNmLlJt51KcRyRbdH4d06XSs3gFO7LfiQMTpfpR5nS6o95BYQyUDXW3o4vz/t4hb Tl8vwpXhwdaNLwOan2HfvIbRKjqo4Hzfl4H87Q9NqiDxpHEPNTnJgegjfIZnwkVnQh qp+tl+4bcvQjszyt0eS9ey/hfu9GHERBtN0gcsSsJoOAqLp1zu3eHS1hREeoqGPaYV wimOPDNWcfrvw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Ml09B4Rflz6tp6; Sat, 8 Oct 2022 11:23:41 +0200 (CEST) From: Philip Kaludercic In-Reply-To: <83fsfylp57.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 08 Oct 2022 11:01:56 +0300") References: <87h70f758g.fsf@posteo.net> <831qrin8jc.fsf@gnu.org> <87sfjy93xe.fsf@posteo.net> <83fsfylp57.fsf@gnu.org> Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB Date: Sat, 08 Oct 2022 09:23:40 +0000 Message-ID: <87h70ehdnn.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Eli Zaretskii writes: >> From: Philip Kaludercic >> Cc: 58364-done@debbugs.gnu.org >> Date: Sat, 08 Oct 2022 07:21:01 +0000 >> >> Eli Zaretskii writes: >> >> >> From: Philip Kaludercic >> >> Date: Fri, 07 Oct 2022 20:23:27 +0000 >> >> >> >> Unless I am mistaken, there is no direct function to quickly test if a >> >> directory is a super-directory of file. As I have encountered this >> >> issue more than once the last few days of hacking, I would like to >> >> propose the below function. >> > >> > We have file-in-directory-p. Doesn't that fit the bill? >> >> I hive tried it out and yes that was the function I was looking for. My >> apologies for the noise. > > No need to apologize: no one can know and remember everything. I only > remembered that because I recently fixed a bug in Dired which used > that function. > > But perhaps our take from this is that file-in-directory-p is not > discoverable enough? Can you describe how and where you looked for > this functionality? Maybe if we know that, we could make some changes > to have this function pop up in similar searches. I used M-x apropos-command "file parent" tried to find something in (elisp) File Names. I now see that the function is documented under (elisp) Truenames, which appears unintuitive to me. My guess is that had I seen the function name mentioned somewhere, I would have read over it since it sounds like a function that checks for "direct entries" in a directory. When writing my own patch I considered adding it to the shortdocs for "file-name", but as the function checks for actually existing file names the examples would probably not work in a portable way. From unknown Tue Jun 17 22:29:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#58364: [PATCH] Add new function 'file-name-parent-p' Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Oct 2022 10:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58364 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Philip Kaludercic Cc: 58364@debbugs.gnu.org Received: via spool by 58364-submit@debbugs.gnu.org id=B58364.166522382413697 (code B ref 58364); Sat, 08 Oct 2022 10:11:02 +0000 Received: (at 58364) by debbugs.gnu.org; 8 Oct 2022 10:10:24 +0000 Received: from localhost ([127.0.0.1]:38350 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oh6mm-0003Yr-0T for submit@debbugs.gnu.org; Sat, 08 Oct 2022 06:10:24 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33974) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oh6ml-0003YY-7d for 58364@debbugs.gnu.org; Sat, 08 Oct 2022 06:10:23 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54192) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oh6mf-0005Bt-Vp; Sat, 08 Oct 2022 06:10:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=kJKDCJKqhEnn6Co7iEi1TMn70tJWSnJudG8XsyR4Sgk=; b=SafikzuMgU3X aJUqI9L4FsZKzW/3WvTFRJVwQbV1s4+R/nbCSmrPNFheje0yhEjBe995rD6i+YP9lyRYtkatdNlrA FAGgnikXlT/xb/rx1hPhKa67TGCworiDkMO33un6Fz9KAixL1UOLYlXpig/TLZb0fjYvYF3/K9hvw vL8UAI9D04o2b477SrpWSg/YTkqPWtJZo8ct1Xzs/bsCwDX/DPddssRLnnIj+xmuuP9HFdWSjjBsF ydoW8em6cJZ9qqmgB6zaRH+oPaVpngqo3te65Vt4JMyKX80Rd0U/+QaxGaDOeD2FHV02piFM+qpay 5RsXlY4Z3BbyuR280DVVPg==; Received: from [87.69.77.57] (port=2061 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oh6mf-0002Fv-EH; Sat, 08 Oct 2022 06:10:17 -0400 Date: Sat, 08 Oct 2022 13:10:18 +0300 Message-Id: <83czb2lj79.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87h70ehdnn.fsf@posteo.net> (message from Philip Kaludercic on Sat, 08 Oct 2022 09:23:40 +0000) References: <87h70f758g.fsf@posteo.net> <831qrin8jc.fsf@gnu.org> <87sfjy93xe.fsf@posteo.net> <83fsfylp57.fsf@gnu.org> <87h70ehdnn.fsf@posteo.net> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Philip Kaludercic > Cc: 58364@debbugs.gnu.org > Date: Sat, 08 Oct 2022 09:23:40 +0000 > > > But perhaps our take from this is that file-in-directory-p is not > > discoverable enough? Can you describe how and where you looked for > > this functionality? Maybe if we know that, we could make some changes > > to have this function pop up in similar searches. > > I used M-x apropos-command "file parent" tried to find something in > (elisp) File Names. I now see that the function is documented under > (elisp) Truenames, which appears unintuitive to me. My guess is that > had I seen the function name mentioned somewhere, I would have read over > it since it sounds like a function that checks for "direct entries" in a > directory. I think a better place is in "Contents of Directories", since locate-dominating-file is already there. More importantly, what index entries should we have for this function to make its discovery easier? Something like "@cindex parent directory of file", perhaps? For apropos, how about changing the doc string to say this instead: Return non-nil if DIR is a parent directory of FILE. Value is non-nil if FILE is inside DIR or inside a subdirectory of DIR. A directory is considered to be a "parent" of itself. Dir must be an existing directory, otherwise the function returns nil. From unknown Tue Jun 17 22:29:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#58364: [PATCH] Add new function 'file-name-parent-p' Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Oct 2022 10:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58364 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 58364@debbugs.gnu.org Received: via spool by 58364-submit@debbugs.gnu.org id=B58364.166522497615968 (code B ref 58364); Sat, 08 Oct 2022 10:30:02 +0000 Received: (at 58364) by debbugs.gnu.org; 8 Oct 2022 10:29:36 +0000 Received: from localhost ([127.0.0.1]:38360 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oh75L-00049S-Rs for submit@debbugs.gnu.org; Sat, 08 Oct 2022 06:29:36 -0400 Received: from mout02.posteo.de ([185.67.36.66]:44277) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oh75J-00049B-Bq for 58364@debbugs.gnu.org; Sat, 08 Oct 2022 06:29:34 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 761FD240104 for <58364@debbugs.gnu.org>; Sat, 8 Oct 2022 12:29:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1665224967; bh=lPweW/YyHTzOJZkrD2w3JTHEsKHhmXd2t1kGEVq1eQM=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=b+3zQBjEHimg9LaD/Oe16CURZUTmgt3u2REbrO+qqWubeeSthmSRRxmBmMhswMepd 7bcMzk8cffYa1wuWr+KIBOBh5sHvqIXwXjxz91j2q/IqSp4x5NOoRErIBOs0u9h0a3 Ezdz2wWGCOTKTElVDKo1zHIMTEuRGQsjmnHVqQQDMspDBFUIlX22BIwBzvE/5859FM y26OGB6Mvh8YNMYGb84MGM5g0RAevolFfrM8SUZzEMNnOrbLwIhLMvZTQD4nthujpH /C076a50i8g7V/jde3Al8bCeweA4zFIMkT9SHhznxSRP7wZ8DFWFB1ukCdbAnrT/1x wGaZkObnKa0aA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Ml1d02mvMz6tmc; Sat, 8 Oct 2022 12:29:24 +0200 (CEST) From: Philip Kaludercic In-Reply-To: <83czb2lj79.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 08 Oct 2022 13:10:18 +0300") References: <87h70f758g.fsf@posteo.net> <831qrin8jc.fsf@gnu.org> <87sfjy93xe.fsf@posteo.net> <83fsfylp57.fsf@gnu.org> <87h70ehdnn.fsf@posteo.net> <83czb2lj79.fsf@gnu.org> Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB Date: Sat, 08 Oct 2022 10:29:23 +0000 Message-ID: <877d1aham4.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Eli Zaretskii writes: >> From: Philip Kaludercic >> Cc: 58364@debbugs.gnu.org >> Date: Sat, 08 Oct 2022 09:23:40 +0000 >> >> > But perhaps our take from this is that file-in-directory-p is not >> > discoverable enough? Can you describe how and where you looked for >> > this functionality? Maybe if we know that, we could make some changes >> > to have this function pop up in similar searches. >> >> I used M-x apropos-command "file parent" tried to find something in >> (elisp) File Names. I now see that the function is documented under >> (elisp) Truenames, which appears unintuitive to me. My guess is that >> had I seen the function name mentioned somewhere, I would have read over >> it since it sounds like a function that checks for "direct entries" in a >> directory. > > I think a better place is in "Contents of Directories", since > locate-dominating-file is already there. I agree, sounds good. > More importantly, what index > entries should we have for this function to make its discovery easier? > Something like "@cindex parent directory of file", perhaps? Drew brought up the word "ancestor", which might also be a word that people would use to find such a function. > For apropos, how about changing the doc string to say this instead: > > Return non-nil if DIR is a parent directory of FILE. > > Value is non-nil if FILE is inside DIR or inside a subdirectory of > DIR. A directory is considered to be a "parent" of itself. > > Dir must be an existing directory, otherwise the function returns ^ shouldn't this be "DIR"? > nil. Sounds good otherwise. From unknown Tue Jun 17 22:29:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#58364: [PATCH] Add new function 'file-name-parent-p' Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Oct 2022 11:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58364 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Philip Kaludercic Cc: 58364@debbugs.gnu.org Received: via spool by 58364-submit@debbugs.gnu.org id=B58364.166522777420788 (code B ref 58364); Sat, 08 Oct 2022 11:17:02 +0000 Received: (at 58364) by debbugs.gnu.org; 8 Oct 2022 11:16:14 +0000 Received: from localhost ([127.0.0.1]:38428 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oh7oT-0005PE-TQ for submit@debbugs.gnu.org; Sat, 08 Oct 2022 07:16:14 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34816) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oh7oR-0005Oz-Ds for 58364@debbugs.gnu.org; Sat, 08 Oct 2022 07:16:12 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:55410) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oh7oM-000453-6u; Sat, 08 Oct 2022 07:16:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=+XvKHYXUU+14+rt8B4ofMnl2Y8VP4WP4jYCqKj8sCbc=; b=I164mfWGlR7A cUEir5q7lEOYKR9BPvasO1LDKyx9ZvrgFUBv2dfk9/LMXDsh4lswZxfGHqYAjUJiriboBeknb/il/ R0BVWhvbm6jA0pxGvXlW6T+lF6CqtNcU8LSxM0vUPFrDWfPhYPK6fTfyW7hHKZnr/yFKwIQ/HdSZ9 8GN5dsYje7chL5pgu2N5BShqHiwa0To9nLqQE5DnnsVCYhVcX3Si0DkS+o+577sHaIl1fZZCGLft2 PTCaKrvD0+71Gu7+w+0yeAOKA7f1hvCLN86JSM5Lf+05tAdRg/yEPYYAVsKV9roMSwJlTN+ZBE0jB 66+OjBmQrFTwRn4wzG/78Q==; Received: from [87.69.77.57] (port=2124 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oh7oL-0002PI-K5; Sat, 08 Oct 2022 07:16:06 -0400 Date: Sat, 08 Oct 2022 14:16:07 +0300 Message-Id: <838rlqlg5k.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <877d1aham4.fsf@posteo.net> (message from Philip Kaludercic on Sat, 08 Oct 2022 10:29:23 +0000) References: <87h70f758g.fsf@posteo.net> <831qrin8jc.fsf@gnu.org> <87sfjy93xe.fsf@posteo.net> <83fsfylp57.fsf@gnu.org> <87h70ehdnn.fsf@posteo.net> <83czb2lj79.fsf@gnu.org> <877d1aham4.fsf@posteo.net> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Philip Kaludercic > Cc: 58364@debbugs.gnu.org > Date: Sat, 08 Oct 2022 10:29:23 +0000 > > > I think a better place is in "Contents of Directories", since > > locate-dominating-file is already there. > > I agree, sounds good. > > > More importantly, what index > > entries should we have for this function to make its discovery easier? > > Something like "@cindex parent directory of file", perhaps? > > Drew brought up the word "ancestor", which might also be a word that > people would use to find such a function. I added both. > > For apropos, how about changing the doc string to say this instead: > > > > Return non-nil if DIR is a parent directory of FILE. > > > > Value is non-nil if FILE is inside DIR or inside a subdirectory of > > DIR. A directory is considered to be a "parent" of itself. > > > > Dir must be an existing directory, otherwise the function returns > ^ > shouldn't this be "DIR"? Yes, of course. Done on the release branch. From unknown Tue Jun 17 22:29:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#58364: [PATCH] Add new function 'file-name-parent-p' Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Oct 2022 17:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58364 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii , Philip Kaludercic Cc: "58364@debbugs.gnu.org" <58364@debbugs.gnu.org> Received: via spool by 58364-submit@debbugs.gnu.org id=B58364.166524967012763 (code B ref 58364); Sat, 08 Oct 2022 17:22:02 +0000 Received: (at 58364) by debbugs.gnu.org; 8 Oct 2022 17:21:10 +0000 Received: from localhost ([127.0.0.1]:41380 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohDVd-0003Jn-TG for submit@debbugs.gnu.org; Sat, 08 Oct 2022 13:21:10 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:19894) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohDVX-0003Jb-Sn for 58364@debbugs.gnu.org; Sat, 08 Oct 2022 13:21:07 -0400 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 298G0HIN019044; Sat, 8 Oct 2022 17:21:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2022-7-12; bh=gmD3IR82cMtVvVsylBxEC8DtrLtXL9u02QPuzyp9wOc=; b=dVlXL9bvQCIYEd1QlBQNQrVqVZwB5nrpNUXHF8EZ6pKG5C0NuNBCdVK/L+qjSvVeSnC5 pcnZ8R1g2B0CVLTdE44kHsTyByYwB072Llk1irmWRxR9Zy8oFeN4g664yJQynnGrwhra 2Z6npko7OgsT32gjTNd/zofjReqBgx0NSvQT90JfI1/6AxUuaXHei0lDsAk/Nk/dmRd8 gwqJ7Jqq0nEygJmyMuRrJUHFyG4SDmBrU+3VHOph9A3xvQ9IeswxFN/OXEggeBOidkw/ 0aGWGoOF6BBZNdXkou3s/GeTdteOM+nKmRv3yAUwFKCzIVMSHLeV5BYa1hPEKob3Hwum Ww== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3k2yt18uss-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 08 Oct 2022 17:21:02 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 298HJdbB029343; Sat, 8 Oct 2022 17:21:00 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2177.outbound.protection.outlook.com [104.47.73.177]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3k2yn8b64y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 08 Oct 2022 17:21:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jNozwTK4ltmgz1/tVm1mtIQ22K9PKVPkeyHY8cenTJDF+mZcbsK1YMQs4YCoV35apKITVMxTV96nPXAALqLjEs1ooWYVHf0nrd9NuXXmj0gl0p7UsTxcK5/i3SrDttssRanYX+SzliM758Iw6CE3iZMoHPgVn5rUga2FSR0l197/jZT+Bs/yFBQRSe9cj7MKONhBWHlhxn3/HpbDfMT+hqvY1TVB7R+LRNC8K6vkAFeRop4CJLWjjdxitG2YL36wvUJCxr5E/pycUc2rZHkkX85rm0j2Yf4mBvhcrh/bWw/il/wDQO2KNEgp7EG+72U3odAiXyFKFI0thnsp+qp2kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gmD3IR82cMtVvVsylBxEC8DtrLtXL9u02QPuzyp9wOc=; b=dmXgqu32KxCkWNMuV2qafH3jIl3cOjjcIeD+eeE9I8Hfu5SH2yAPWVfzloL9FB0YAYhww+aARe36PRm7Cima1o2orW7W0yD6G+vNL7AffQgD7uqCyKlVrgENXE/uqcWynQNBD0q/fuPh0JAMP5X2LdaeGERBqOSoVUqDMXaRNYIT27zU6maEahJb1ZTbHmg7TUm/1Sza114LI/sAfyXx2HiqyK7H8ixDfda0B6h4zsz5Rbv8pbLt4BVchxxwmGyVaeIdMoZSqw+7H/RLu6OXR7dAA7w5w67b+g4c343Xn6o06GUyMmibeElrVp5sh4vrMaspIiOm3AsBfK4evTEMGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gmD3IR82cMtVvVsylBxEC8DtrLtXL9u02QPuzyp9wOc=; b=THkvmQvUqPiIqQ/RAp6+jhw86QhUVFOWVC8tmWBpLKngc0U5ov9L9SNvxlPYmepgrSiO72gf5oIrYSS+epwaqQwYifVCEgRSywstwiRpz+mbgo6GaoC0WWU26H2mzXyJac9rQ8PV7ivprR9VNMi37iTmwSULxJk18/j/jXEBolY= Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19) by BN0PR10MB4918.namprd10.prod.outlook.com (2603:10b6:408:12e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15; Sat, 8 Oct 2022 17:20:58 +0000 Received: from SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::f319:dced:1a48:779a]) by SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::f319:dced:1a48:779a%3]) with mapi id 15.20.5709.015; Sat, 8 Oct 2022 17:20:58 +0000 From: Drew Adams Thread-Topic: [External] : bug#58364: [PATCH] Add new function 'file-name-parent-p' Thread-Index: AQHY2v5KVQBKhCinrEu6zOcUHXJmq64EsQhw Date: Sat, 8 Oct 2022 17:20:57 +0000 Message-ID: References: <87h70f758g.fsf@posteo.net> <831qrin8jc.fsf@gnu.org> <87sfjy93xe.fsf@posteo.net> <83fsfylp57.fsf@gnu.org> <87h70ehdnn.fsf@posteo.net> <83czb2lj79.fsf@gnu.org> In-Reply-To: <83czb2lj79.fsf@gnu.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SJ0PR10MB5488:EE_|BN0PR10MB4918:EE_ x-ms-office365-filtering-correlation-id: 0792232e-b563-480f-dd0a-08daa95176ff x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: yzbsbHaV9T1o241fu8/tVQ16ctYFK5gsJTYUVzozVgMPzQ1Nl6d7Crh2JSPipaqHJFBJ+3/z1KUv2jUaym0AEJzUcSZzSZzCTHVN7bqvXFe7OsJ4DqByElHqkYu5XWeWt2+2QIZs1JfgaYkjPjmTxrHKrBr6ttGts9AytGUhor6KpsQyGtdCHGe/TyyQ7KAblW9glUaKt9BtdOgq1VMeIm8cmeXRgjX/Im3GF6q0zKAHQcVthrxqi4P5tXfidAJZyvSSRuC0z5gyTS48DuMNR1/HBsN9X8rwc4mR21A3/4f6HpI4ejlIAXuGLV61iSv++XgrAs5B5nQCIJYLocV1KDYw58qQnDreYv8kW8WzhGjmp3Ryt7Qg5N6UCH/IYrpB4yW+FwzORFzJbh1YJusHshEvdFLKJdcxWWPHzjFGK85f3q3s3IERU4rzQLRY48NaRBfoRM/rPFbhxJ6tJzWItHmPwCPSFmT30rQi6M5tAWtC+XleoWOdxG650bX0MiJAmOq/7PxBIJONxRDN+Foqzcfx4W3FAePhb9QwQgElFkqDxMae6778qtmyVar9xruV7FE34J1mmElfCmcmJKomqejoArPk6Wxw0wgknX7dSZnKi2kFhM0oAmoJyRGF8kStMHaLmPvXJnPv5Q4HTuHQ5MZHui8nHXjWs4iRVdRJ4rDxpXkD5qjU0lmq3NGmCU31f4BK4W+4jgUG4pUDUxKDLbjFncBUNLpJWD8a2T3ub+dSgtHJT+qyKWcSgOG+qfFQz8oTWiSwQCkIigcv6XIV4pX5i03PuFGyUEVRjQHRFY+6hVgeabzWfvL//Brqc5NLToVi6tIuizd9p8euR+B27A== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR10MB5488.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(136003)(346002)(376002)(39860400002)(396003)(366004)(451199015)(4326008)(41300700001)(186003)(38070700005)(66946007)(66556008)(66476007)(66446008)(64756008)(8676002)(76116006)(86362001)(2906002)(52536014)(8936002)(33656002)(44832011)(5660300002)(6506007)(7696005)(478600001)(38100700002)(966005)(122000001)(71200400001)(55016003)(110136005)(316002)(26005)(9686003)(66899015); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: t0sTkJG47Qg13zYlYoRmHQaG4FpjMp2JdBJhBkW/usLVNSMpXzoh563cWd4TCzuvrSZnS+vQBhNeRqPt1G9HGZz+rUeNe8r3Aosl7vg1mjy8Kmk30HbFU99uAWw3w3O1I40+WxeCQrBCCARZyscVI/B6cvNVzMgH7FVOR8FYEz5BXAqj39cKsgZX1R7XIu2I1ho+ga8NE3y3Pceo5zieynwkDi4+4zDvnUm7lhcIkMydfvKkWqX5HLlT/97BWV+m07UKo7o1X5NWLfohXqNnRFG7aXtvYzQvYlN3e86RlN7V9gZP2CpVMFWcaI+4gn1p33frtXFuRRE/T56oNU1JmQg0lT9ldtPumW2LiXOapQvoPc3HKW6NR3MVF8+wwnMTibnFG4pd+0HK6t+GpEIMUyriKaPYQKt6dawGu0C+SyFlNzxi4pZLPhh4YX9nYLWTNsj1oIIBdStk0s2yJEHBd/qIlb/mUBbR6waRHb7uT9ns4uXpMGWhYdWU0t8U6XNsbMGqhjPgHc8ynwF12IEBNqJvI0hHDr4KYiZMXEJo6hI4CJq95zgSMIt82Q2GSeeQF2OmV3lm/saJNeDwcSc9JjrEtsgDUQD+Bft5tM0SZMJaX7l82G4pA2ToqehHyFAOj6zd2+MnmldwcgPuWe2oQbS7u8eqkWOI0OkvFmg9zi2TqoBFvsM6JWHkUDAzSpUbwU5qa4uTYtQ2wbQarEU5BBhxn71KD8SPv/zf9oujIAIbTraVamtx8ofoEQ58BzxgF0eY0B9ZWP3KfiWbYJUfJ2/SWN/ZKHpwKXDmT2fE3p4HuNKdcj9agH+DiHQVdlSOMyoUtmYFtgIShuyMHda4RDZh+3gPV7wwhWSZ7/kEbuuq7xRu2RKU7QOJWedPV1YgN/pYO5+E7aYHcx/WwsjdW8i7M4Nn1jsLYHt7uL6FAjaQxyr6LfAPMy5xmSCc5XT/PHy9gVNN8BfepFSyC41dE7zGsibhMetFciQ6mFxAEeK+c+Sz3ZHQ6A+yISCDnQgxs3KRsbmUulGe9lhfMouI9GC9s1TSVu/yIOyG7pSvQ/afapb5jUZJ6m7pkq473HyKbzhGPTckN1CaPnVlUUHxipfpd+uPyIuVGX/ERbWsvIf9/eZHgNhHI+2LCcprcOuGc64uspjaBIvYe542gH0Ht0LYxDJJPAEBhLFLdAiOlWz4Hh0+ZmUI1UHsmnkXTZEoAdoYuV2D88NtKvDjg0y5tWlmRoPxT4rAZ5zVqcjk/vLvlk3JSJeV1gOH/K8Z7PI71OqnNKXDDizNm45LOOiwhSC06ak/jE7xB2RyspecPrNaDFPMpH/dPyl3mliw7ylSvNixsYCwmuycHQW2dKmR5ht+qF8G6+Nsr/IPyxHo3QWI8vk/ec3+I3dFmJZqT2033i2DkAC6CS5fzcCoSj4jhEsXlNoS4+IklAbw/gRqvPXlLQDQCiZiokCOj3AXquHBBOW6Ysp+5if4lQ0IPbaLWEvEuYIObaZTy9ruFO0K3WPjDY6B8m0kOumJ8Xqjc1lkkOf3mTqVcD2EY0ZfVGf/+AqhRYo8WcCGnGMq6vDin0XI6UvrgII8RdZ0MvRRh0q1 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5488.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0792232e-b563-480f-dd0a-08daa95176ff X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Oct 2022 17:20:57.9958 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: l3xj0wen3P8/llYM568G96TJ9uMURI/F2NZP+1NEC7OrJLOvNoJDZzb3QREtovBz0barDS8vdHbINazY61Q7bg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB4918 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-10-07_04,2022-10-07_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 malwarescore=0 mlxscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210080112 X-Proofpoint-GUID: mjeAGwdDLnxxxylUSA0lwF9pB-DocIE6 X-Proofpoint-ORIG-GUID: mjeAGwdDLnxxxylUSA0lwF9pB-DocIE6 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: > For apropos, how about changing the doc string to say this instead: > > Return non-nil if DIR is a parent directory of FILE. > Value is non-nil if FILE is inside DIR or inside a subdirectory of > DI [...] Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [205.220.165.32 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [205.220.165.32 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 URI_DOTEDU Has .edu URI X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > For apropos, how about changing the doc string to say this instead: >=20 > Return non-nil if DIR is a parent directory of FILE. > Value is non-nil if FILE is inside DIR or inside a subdirectory of > DIR. A directory is considered to be a "parent" of itself. This is what's wrong with talking loosely about a file being "inside" a directory - confusion. The function is called `file-in-directory-p', where you expect "in" to mean _either_ "inside" DIR _or_ "inside" a subdir of DIR. And does "subdir" here mean a child of DIR or a descendent of DIR? Right away, this introduces confusion. What does it mean to be "inside" DIR - does it mean be directly in DIR? Or does it mean be directly in either DIR or a directory that's a descendent of DIR? If you mean the latter then it makes no sense to add "or inside a subdirectory of DIR", since anything "in" any "subdir" of DIR is in that case also "in" DIR. And then there's the first doc-string line: ...DIR is a parent directory of FILE. This is wrong. The predicate apparently tests whether DIR is an _ancestor_ directory; it doesn't test whether it's a _parent_ directory. In some languages "parent" can mean "ancestor" or even "relative". But not in English. And this leaves aside the problem of whether you really want to say that a _directory_ is a parent of a _file_. A dir _contains_ files. Do you want to also say that a dir is a parent or ancestor of a file? (And this has nothing to do with the fact that a directory itself is also a file.) The predicate is about an ancestor-descendent relation, not a parent-child relation. And it's really about such a relation between the directory that FILE is contained in directly and DIR - that is, it's more precise not to speak of a directory being a parent or an ancestor of a file. (But if you want to skip over that distinction, that could be OK.) The predicate name is maybe less important than getting the doc to be correct. But there's really no reason they can't both be=20 accurate. And if Emacs starts using accurate terminology here then search, completion, apropos etc. will be more helpful. And the manual's Index can still offer (also) entries that are less than accurate, as some users may well think of a term like "parent" before they think of "ancestor". That possibility isn't a reason not to use more accurate terms in the doc (in particular), or even in the function name. https://en.wikipedia.org/wiki/Ancestor https://stackoverflow.com/a/10993384/729907 https://stackoverflow.com/questions/55607027/git-what-is-the-logical-differ= ence-between-parent-and-ancestor https://stackoverflow.com/a/54889445/729907 https://sebastian.expert/ancestor-descendant-sibling-parent-child-explained= / https://teamtreehouse.com/community/what-is-the-difference-between-an-ances= tor-and-parent-how-do-ancestors-parents-and-child-elements-relate https://www.wwp.northeastern.edu/outreach/seminars/_current/presentations/x= slt_intro/xpath_intro_tutorial_08.xhtml https://wp-qa.com/what-is-the-difference-between-current_page_parent-and-cu= rrent_page_ancestor https://wikidiff.com/ancestor/parent