From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#56355: 29.0.50; Implement file-parent-directory Date: Sat, 2 Jul 2022 15:29:18 +0000 Message-ID: References: <0f199ed7-abef-d74c-b5fd-c9c81978c143@gmail.com> <83wncvbuht.fsf@gnu.org> <8735fj3e9n.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="303"; mail-complaints-to="usenet@ciao.gmane.io" Cc: daanturo , "56355@debbugs.gnu.org" <56355@debbugs.gnu.org> To: Lars Ingebrigtsen , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 02 17:33:21 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o7f7Z-000APf-Dx for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Jul 2022 17:33:21 +0200 Original-Received: from localhost ([::1]:43802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o7f7Y-0007NM-43 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Jul 2022 11:33:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59196) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o7f4N-0005uP-CD for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2022 11:30:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48670) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o7f4N-00036x-35 for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2022 11:30:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o7f4M-0006IS-MO for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2022 11:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Jul 2022 15:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56355 X-GNU-PR-Package: emacs Original-Received: via spool by 56355-submit@debbugs.gnu.org id=B56355.165677576724137 (code B ref 56355); Sat, 02 Jul 2022 15:30:02 +0000 Original-Received: (at 56355) by debbugs.gnu.org; 2 Jul 2022 15:29:27 +0000 Original-Received: from localhost ([127.0.0.1]:42566 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o7f3m-0006HD-RO for submit@debbugs.gnu.org; Sat, 02 Jul 2022 11:29:27 -0400 Original-Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:14772) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o7f3j-0006H0-Ua for 56355@debbugs.gnu.org; Sat, 02 Jul 2022 11:29:25 -0400 Original-Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 262DXBwa026803; Sat, 2 Jul 2022 15:29:21 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-2021-07-09; bh=wI8IYIs/i9lyMBPic8daXDrb9ISE7YrqHFX1XxEwZkQ=; b=OrXSFwjsn/TckhCZ9MNShsLc1Tbn47uPthrF+Ls1ugH/G161FyuzBsX1F0nYxrLYAdst zVotBpg7gnRTJ6RMWSWshY2Z9c9VLpqPgi2+oL3H8nYBh25KvLoYpYkuVxF6Fwsjupln llzxfoFZl69JERhBaXuoRmhofavAUHYy9Z3NBdKP25hZHPj5g6xrmdr+Me8PrOvcg6Sx bmqtyysGffv7yygtWhXraMKOCl1drJ4jyYHXBCGm2Los//+vIp10yPjl7/avhizk5TYd Q05Am+Ku38N1mqUzBsHJD8Ld/q3SAjTuXwj4BZAwHk6Hm0xwLwmpMDSid0Oa7HOFEIPy kw== Original-Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3h2dwagmkd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 02 Jul 2022 15:29:21 +0000 Original-Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 262FAtrV027742; Sat, 2 Jul 2022 15:29:20 GMT Original-Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2172.outbound.protection.outlook.com [104.47.55.172]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3h2cf6ryua-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 02 Jul 2022 15:29:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XlupxGp276LOfVnh9tRR7j9zo4JjJvaTZ7qxSP7Kw9NQmCw0vJKp/j8ye17Dx5swtG8j9wKP76PS86zwH4t9PmdzeLp43jHJxiv59UEU1sWClMwHxEZky6NWg4NNk5RigP2t9NiAtXCllQZqokXS4RJnt5bjUUy964so3tONFPscd/msLOcO+pmAryL/3QATP91uPfpvytS+EmdJBg5kfvXBYqeYNsPbX+kbtPsrmbuB4Q0uz1JFKHpyGIalxa+Hk34jrhRHMSpQATOeTkOI/P1Mc7AAWyhL1vRY5DATyCdPkef3CzUCbWDadLaAsToZHLqNkRRTAz3N/exJTKwZLg== 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=wI8IYIs/i9lyMBPic8daXDrb9ISE7YrqHFX1XxEwZkQ=; b=CNc8Q8M7ObzgZMdrtGWL8bOTawjSNNIt8slbkuTyH3ZSIfFNY5cGjkHd8UItmUJORCjVD5TBkE5u7XRPL2N5TYE7Q9GPsGqr4M8ZFBhFsWFmDUcqo0B272IlW6xlExoYO9domNu/lV8RSUvLeHbqZR371wPxqRahw/CSyVZwJ9AIaJOQk+08/mnXopymwcY8cu48iFnq3CBERqrkSFzVT6XzbbOj2jrjTJsPVCC0eoL1VTe6Rh2rr0Txg4M7NHSQ+yLsYsxiqhS/w6WHVR1AiNTJeOYfGVn6qH5orWqz9jjLXEm0asLVrCmaSE6VP1jwScoIdB0g+LWSqW7SCod/bg== 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=wI8IYIs/i9lyMBPic8daXDrb9ISE7YrqHFX1XxEwZkQ=; b=uWtJ9FKsqn6ikzQc/VQbLvZNQ8XnP3Q2IYZOQmlcVqlOejf6J+d92gZhd5xzTQ7o/UxNoZtlmjdCHJ4hXfkJy2TrHS7E/SvSP2s8l/pK4ebnH4VVUDJ4G/XRNPt3GGKsR16ch2MxGCheb83gu8ZZvxs+WsEFq6Vso8ixxe4KgMo= Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19) by SA1PR10MB5784.namprd10.prod.outlook.com (2603:10b6:806:23f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.18; Sat, 2 Jul 2022 15:29:18 +0000 Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::581b:ae2f:16b9:80fb]) by SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::581b:ae2f:16b9:80fb%7]) with mapi id 15.20.5395.018; Sat, 2 Jul 2022 15:29:18 +0000 Thread-Topic: [External] : bug#56355: 29.0.50; Implement file-parent-directory Thread-Index: AQHYjgz0f/cuK6cdBUyoqgPcHOPxiK1rMvzg In-Reply-To: <8735fj3e9n.fsf@gnus.org> Accept-Language: en-US Content-Language: en-US x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3399fd70-1187-4ae6-9fac-08da5c3fa128 x-ms-traffictypediagnostic: SA1PR10MB5784:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: O77TsMGBTvaB4+FGjucTiXNC/BgYH4bX0mkRtPg0Yp9MVz9TOCnboRmoyQs7NgIxuZ6HRBEha8EHC0oYZEXerGpSiI9rgITjLupOaO5uPuchS3s752LDHixnSGGluYfg59ERtokO/UOYuAnAFd6vJLRGrO4meFfB58OBx6hwqM3SpyPMKjQ3agNp06++lEnmAX1ePSc+sxR09BZgBUxrbMycsJlT3FdihRSY6LDv1x6ZmcPx+HUGq/hVEZBG6/9yOOenCPxsKKPqZd4MTEkKkud1hAvNZ4eh6mUR6l1D7HM5YtzooB0QGXvk2DfZZ0/+o2ww2kgnNXWce/Y7egCFCjtYcaH1xNQgpODUYVqLMeSr9TuA2WDO+IadsLGM5NZdY84gA5J+M2Cwmh4uuYr0+0mo+7cuIFQxOUhWkp3udmdvbVSuIcHS1JmTAu5vQgR16VLbE3cvWow7pZpmkU7BALIVivJwgyr8UrEm2xApWT6zW9a7zkW8SXVXT+Sy6DuUxszqEElk9KlwTvRdmdSCLrIbxQO17HnsHAE4BFk/kx3I//jOQMsKZjTSAp6ytBLPqBRI//EnmcmerK/QTIZ0YKqALZw4ZUwipwrXKArRd95QovvQbpUuDJ7pswiB/3kahAiKww+aYpcS6rflUisT3D4S9natuny+41wVq1MQJHJi0J9E6BaxICZ8y2xuHOBm/okile1ePQzDBqwZuJ0oZVgK9/mJ0mqIrHkTRuGEppSCFUMJkLDHBabSoWjXH vP0fRE3Qes/hdG7yLEsjsg0pF0PaBUlCpRH6s4eDz7oamXsvbdDGD5mjVBCzAEm/9g05rRcPj8NMKiURpE7h4ZQl/T0h2h6nZk 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:(13230016)(39860400002)(136003)(396003)(346002)(376002)(366004)(316002)(122000001)(110136005)(54906003)(86362001)(52536014)(8936002)(44832011)(5660300002)(55016003)(38070700005)(76116006)(66946007)(66556008)(66476007)(66446008)(64756008)(4326008)(8676002)(9686003)(7696005)(6506007)(26005)(186003)(71200400001)(478600001)(966005)(38100700002)(41300700001)(2906002)(33656002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: rvk6rzffr1/iBg4MJa0TU+RqM7qCB3I7DUNOH4Y0Q75LqkvrcAo3epqVnj3w3/A3Kvk3RTTrl/A1Xh3hXSvAF/6pXuQ7zNo+uOPCyq9CRjrfRL9Io5KHR99lom65pxaiO9NXB3+toIDuyi7YuxLYDYsTejSGg2LvsNRrI0oFrEuU7rjrTM1io5lbXv6FcU/PIO9N6SQJ7cD6f2cwELvKQd2TVejJEboyc90dEChKXpUnbmlPe3jUXoDMI4KKIkTpEVC1ZAudjJpY7+RC4AD+R2spnD1eP6VMhUkgRg/HvqL7Es8TT6wkiaa5P1CbKUWr0noyX4o4qD9AzvwS3D++Zsub6ptZY1qxmDK9rlEDkLesvEIiK2XTSsiANPIWvMBWD0IAtfc+ojBR2VOfKiuLSUUcWSnXOaJYh4cZR3ksiabQTHIW2U+Y2DHhyvci7HIe/6UcpQp18hY4fKni/mNJwI+2FwiYHUBzlgPIhcpvqqk34hC1JARlXfXUom97nkmrxqCEAFsaztSEcBLCRHcQjsG6bDEgfZJhMtBty7GBVHHJwCGPRiCYW2spWeFQfaquR3OSx8IkupQZnrCCaLlpmCTZdnM8u/VVbbzuFIWDQKC7/42ezrv0X2M06oLyJyjPuK4U2mMfPUssAGEGqbDEHsqNEIJ96HXRD2f/BqAU9jAtY4p5GzVJukzHGoX0Wp7bGhQhnf7lVf99pTw0SIwKZPVk3B2ID/F28xnaeLUdoK56XBDjofIBYNNNYx Hu112IejBGf/1K+REN7t/Remj+Tah2Kt8rt485JBhitA2VxV2JaWtHcN+lwv71+AKV5E/vKjQb2XYOP/PxNzXmLVAcpkDcaW/T 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: 3399fd70-1187-4ae6-9fac-08da5c3fa128 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jul 2022 15:29:18.2210 (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: I4K2LuT1QjpWo30+si7GuSdOObPb6ahnWdPLN+YTfOWhsRVGYe0W9iYcTOQZzJFI4iFiDomQxAUKz+nKv5uYdg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB5784 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-07-02_11:2022-06-28, 2022-07-02 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=777 spamscore=0 phishscore=0 suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2207020067 X-Proofpoint-ORIG-GUID: _mvRPxl2EHOaIbyenq8t5Wt76nX5s-Mh X-Proofpoint-GUID: _mvRPxl2EHOaIbyenq8t5Wt76nX5s-Mh X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:235919 Archived-At: > > Thanks, but it looks as a very thin wrapper around > > file-name-directory, so I wonder whether we really=20 > > need a separate function fir this. Need? How easy is it for a user to find and figure out that a combination of `file-name-directory', `directory-file-name', and `expand-file-name' can give you the parent directory name? Maybe your "we" is focused mainly on Emacs developers? Such a function is helpful for users more generally, even if not for those with greater familiarity with the available set of functions. And yes, how to do this has been asked multiple times by users. Here's one such: https://emacs.stackexchange.com/q/9554/105 > I think it looks like a handy utility function -- we have quite a few > instances of (file-name-directory (directory-file-name filename)) >=20 > (possibly with an expand-file-name in there, too) and using > `file-parent-directory' would both express the intention of the code > better, and be less error prone (because many people forget the > `directory-file-name' in the first attempt). I proposed it long, long ago. This version, from Dired+, allows an optional argument to return the relative name, i.e., just the parent component. (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))))