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#52395: 27.2; Expansion of DIR arg of `dired-buffers-for-dir' Date: Thu, 9 Dec 2021 21:59:46 +0000 Message-ID: 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="12008"; mail-complaints-to="usenet@ciao.gmane.io" To: 52395@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 09 23:00:26 2021 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 1mvRSi-0002qz-0D for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 09 Dec 2021 23:00:24 +0100 Original-Received: from localhost ([::1]:40694 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mvRSf-0000eK-Sk for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 09 Dec 2021 17:00:21 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvRSN-0000eA-FA for bug-gnu-emacs@gnu.org; Thu, 09 Dec 2021 17:00:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33381) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mvRSN-0001HO-3L for bug-gnu-emacs@gnu.org; Thu, 09 Dec 2021 17:00:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mvRSM-0003VC-QU for bug-gnu-emacs@gnu.org; Thu, 09 Dec 2021 17:00:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 Dec 2021 22:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 52395 X-GNU-PR-Package: emacs X-Debbugs-Original-To: "bug-gnu-emacs@gnu.org" Original-Received: via spool by submit@debbugs.gnu.org id=B.163908719713419 (code B ref -1); Thu, 09 Dec 2021 22:00:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 9 Dec 2021 21:59:57 +0000 Original-Received: from localhost ([127.0.0.1]:44927 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mvRSG-0003UN-Kw for submit@debbugs.gnu.org; Thu, 09 Dec 2021 16:59:56 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:42344) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mvRSE-0003UF-LG for submit@debbugs.gnu.org; Thu, 09 Dec 2021 16:59:55 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58472) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvRSE-0000dZ-79 for bug-gnu-emacs@gnu.org; Thu, 09 Dec 2021 16:59:54 -0500 Original-Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:60954) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvRSB-0001FZ-CB for bug-gnu-emacs@gnu.org; Thu, 09 Dec 2021 16:59:53 -0500 Original-Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1B9K3uXA012347 for ; Thu, 9 Dec 2021 21:59:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=corp-2021-07-09; bh=CZUcO28/rw1S5MELK9aFYUrCjXps8cMJfmZV+SYzTb0=; b=Kkv4cgLuL15GfT4secy9E4GGx9/2FP6QENsCPWP+x9I5JuTOOGom4943QJCxI5K/h7D5 vw2Vpd17FjU3DvnV7zHiHAvANMtrbZtF3YLR5j8aQjD/llz+FpILR77Fwj4mNeSbpm29 20fnvPW4WVEi6pPgbd3Aft5HTPZXUUPac5r1MQf1yHkX+ffw99C4oMBsAydbCd0IDiEX UCDtjGZHOns4hNlrymTdFRAwpcv1nerFvdqWNmSawklW8Xw6eVUX1B/jrR5D0jX9YFW1 oGmLeW90XlKVql9bPIIsrYaYGMIcAF4v0i9FH4SiPinkBiGasVIsq5eJQ4l9lL3SRTm1 bw== Original-Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 3ctrj2vvev-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 09 Dec 2021 21:59:49 +0000 Original-Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 1B9LaDK6189421 for ; Thu, 9 Dec 2021 21:59:48 GMT Original-Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2102.outbound.protection.outlook.com [104.47.55.102]) by aserp3020.oracle.com with ESMTP id 3cr058dtgd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 09 Dec 2021 21:59:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PhHLkto4LUQwjjnnWjk6wtmw4prpJ/59gzvdZNuYM8MlJe37Vj0aqOz6shALbYpiSQcWdaOqzO9noflrPH3RpRdjkBwFhENr9JeIMbRRceMJq7NZFPfd7RnjnUhON1ijdDY/Ua1k+wuPwaxiBGEkX1uc68MD3dXIWRuM37cFSQEhW6UqSNKpySgou2ApKtOr2ZgdLueT1LuEJ7DNC9obBnju8MQ0TdRe1COf5bohDhCsY/DPq6VqdGwb5gUANHfLSKwJXCQXIT+mPBef5wHOjMwIC6hO56XBWLUX9YL70lkLZZilAtPmBZgsfPly+ZYiP12LNyrtvpmQJdgokiy4MQ== 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=CZUcO28/rw1S5MELK9aFYUrCjXps8cMJfmZV+SYzTb0=; b=UeM9ROhV3HwOVun0Ov0U6L+N3W23e30XNaD+5UhRsvN0tB0L8JvpcLJA3qUCVcod9G+S84pzqyVYHQd3aeqP52RL6bkwu3CTae3RjaLfQY8fRz2iqgZlawdmZnWJORI5XmLehVT4XSyfJeCjZJYCvTzweBbCJKVcBYH7iCXcluWWnLVO2NTlp+Dc7VFv99q0ogNQSfplRBRXOZPpR27i9EpNCWG4zZjiF3syvoA1gEdyij5Eq575BDucX597IONkI/juzlUlbQ8ZuaFkml7qfobr9ZLragL16gLPvXGXo154vnIWP55X/jjU0taE5aSzcvBxEf/TxxqkL2bCjrWB4w== 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=CZUcO28/rw1S5MELK9aFYUrCjXps8cMJfmZV+SYzTb0=; b=aix5YUmo+YtzKK/AQOuK3wksc4VX/ZtHNfn4T1r2UYJiXZaHufjAbNZjEndQew9z6DdMvyZtzB8ZA9dXGzHw20dDPm57ogZIoMMRw6L0z7Dzy/csLmz+Sj/FSwkL2oysbGowvw+jgU1ij+1QQzXXYd7sVReG/+t2EogQzO1JUC8= Original-Received: from CO6PR10MB5473.namprd10.prod.outlook.com (2603:10b6:5:355::21) by MW4PR10MB5811.namprd10.prod.outlook.com (2603:10b6:303:18d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.11; Thu, 9 Dec 2021 21:59:46 +0000 Original-Received: from CO6PR10MB5473.namprd10.prod.outlook.com ([fe80::d0fa:fa4b:7c65:ddd6]) by CO6PR10MB5473.namprd10.prod.outlook.com ([fe80::d0fa:fa4b:7c65:ddd6%5]) with mapi id 15.20.4778.013; Thu, 9 Dec 2021 21:59:46 +0000 Thread-Topic: 27.2; Expansion of DIR arg of `dired-buffers-for-dir' Thread-Index: AdftR00rQd0GbEQIRwmtFzThT0cL5Q== Accept-Language: en-US Content-Language: en-US x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5327fad2-5aee-4e01-68cf-08d9bb5f36d6 x-ms-traffictypediagnostic: MW4PR10MB5811:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: bsMQ14eE4DyngnP+bfRqp32lTdwaR/3BmELq/yjeQfchsSXQeTG1TvLZxplDgGFABYzt078h4dWTkQALMIcXyRkfJ0CxEHaTy/AzZ26+3vyZr4zg7MPlnlY+1iu6eRRfEhlzCOIrouKHyQKuQN4Av8CnblvtvkMJZhEJ5DG3NL2umoWrN9BzeBB+QFlGYUFpRgbFy4ZP+VHOQ1pvdCU5xZ0aimj/5aG/fNb2K+K1LIK7HDN3xNF7v4uzPro54cGuJHTGRl8tl9ObcYKWPF6W9Bm/dOISZrdV6hr+6qu9jvuSu//xpYUgi5QA2BMxr7noS3wsdquCCAoLOnd5AD82iPALfpunMS5Ji9jXd3JKQa29qpJOOR/gobg+5ubDWJihvVvJGF8U0TZHmEOo8u7Oyf8IJPR7DJ0ncdDvGpShOHn+lZTOKLs4QCGl+JWJfQ+Ll7ftK5X6887f0ccVsagqV8VGlLMjmOKSiwZITX7JFebGxJ2pRMpxuGFZ4tPKNJnqDPFI/q7GUo91aCsGbxcpInZ+rI5xd6R1gAxc5t/u4GLz6sb1eYjnVFuzDGDxObL0CLI85mN1/1zUJZM13AkKlw7qxQbIZQgieOMLPgGtTx1KeznRob+uUuDRIGQU/VeoB+CJuT23sn7pp5sUPbP3rFMagRL0tEQ9gixe4rt//Rk5XAFHunJcHbrtnup0AyGF502sJZ4oKDNSSOecQsZlvPm1ysWbM62eITD8fuO5rXY= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR10MB5473.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(6916009)(9686003)(64756008)(66446008)(508600001)(186003)(8676002)(7696005)(316002)(52536014)(26005)(2906002)(44832011)(45080400002)(71200400001)(6506007)(55016003)(8936002)(122000001)(86362001)(33656002)(83380400001)(76116006)(38100700002)(66946007)(66556008)(5660300002)(66476007)(38070700005)(81973001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: CqawlMfBvrhT9uNj9pIyYud+ajB8hXfH3urns+I0OCsb6Ge5A4ebjK8aYk2yiX3P93/iS5jSRA/kBMp/mb6mMjJQZmoH9PykKqpblVpaatfrWo6Yc3/+frltD/corgFcLdm2b7GuYT+XJKak6UfiPZHuXkmKl3Jh8OCvYjHxLiPwAKehsYcVJaco7sZ444xK+9YKD9SyU73Vsv8e1/stdXBNq65l5MJYwJNG/EllnpjspXTv/6cdCbJRnERT9ZLSdid6okwSXIiiZN/C2XX3tJDuG0/ru2qCPE1+s5H4pSvw7vSfEXbAn0b+PRqC1vrUSBzoodq2WAyX+4yQauGEetI45fbp4fq8DWVOD27slh3tw5jnTbPipbjcBbQ9DZMJZF1EQqPEJpGaKXWj5khjILongQ9GJHS+4Czd+bgxkE10jNMR+Hv/QsJb/Z4PNtx05aoq3vyxd9UGEqfkuR6Fnr18+UVKQG0Ng8KOesl8Oe8F0BiYeM4tRFLqvyZ/+hQR0OhfGEJH4Cxmy22RJHwX4aYKcVOxacNiBGqvfNl4JZ3voKDSHQ3teq1O3QJ6h8LZirhpBgfwBQeLCg/jh3JtwLSRbFSa01dTKxO7FnC5cJf/rD6xouVTTKoeMREHLv1zCzU69/KZ0nULT86VswsFix3rGKvsmelJEpGs5A2DiOFwjGt9QdghY3ssntMIa7mkfKq3Dlw0nfMQhVr7MklsjINme6v2MQbI3FVqHzmhNx7Bsv3cbGJie4IGTT Sbv2zNP3AyoVlomYUlgf/Q35ct4/mpEaKGn+yRpuhpp9aJtOrvyVYA3L98G3H7Xr4oyE0ve74TJu08YUOKGh+CErXnaXY1D8au X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5473.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5327fad2-5aee-4e01-68cf-08d9bb5f36d6 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Dec 2021 21:59:46.4888 (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: woK/ERzTahrJEWuJsSCzftfNj/oCOPk/2YgX9ECZr0Baxm+qFA6K0mti3e7PmlFCb5sTBOaljfR3esyE0oaU4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB5811 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10193 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112090112 X-Proofpoint-ORIG-GUID: dXBDhqYpUtze09jUiENyZwPMR4S-k2hX X-Proofpoint-GUID: dXBDhqYpUtze09jUiENyZwPMR4S-k2hX Received-SPF: pass client-ip=205.220.177.32; envelope-from=drew.adams@oracle.com; helo=mx0b-00069f02.pphosted.com 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-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:222023 Archived-At: This bug report is in the form of a question. Shouldn't this function expand the DIR argument using `expand-file-name' (e.g. with `default-directory')? I think the answer is "yes", but perhaps there's some good reason the answer should be "no". All uses of `dired-buffers-for-dir' I'm aware of call `expand-file-name' on the directory passed as arg. If you instead pass, say, "~/some/dir/", then a Dired buffer for that directory won't be found. To me, that seems like a bug. The "problem" is that the code just uses `assoc' to look up the given DIR argument in the value of `dired-subdir-alist', and entries in that alist have absolute (i.e., expanded) dir names as their cars. At the very least, the doc should tell you about the gotcha - it should tell you to expand the DIR arg before calling. I'd propose changing the first line of the `dired-buffers-for-dir' code from this: (setq dir (file-name-as-directory dir)) to this: (setq dir (expand-file-name (file-name-as-directory dir))) That way, there's no need for callers to themselves expand the dir name. (A question is whether `file-truename' should be used instead of `expand-file-name'. I guess not.) Such a code change shouldn't change the behavior of any existing code, since that seems to always use `expand-file-name' before calling `dired-buffers-for-dir'. If this code change is made then it would be good to also change the doc to say that DIR is expanded relative to `default-directoy'. Code that needs a name expanded properly relative to some other directory will then be sure to expand the name before calling `dired-buffers-for-dir'. ___ If you don't agree to such a code change, fine. But in that case I suggest that the doc of `dired-buffers-for-dir' say explicitly that argument DIR needs to be an expanded absolute file name. The doc needs to explicitly say "expanded", because `file-absolute-p' doesn't test for this meaning of "absolute" file name - the name cannot use `~' for a home directory. In GNU Emacs 27.2 (build 1, x86_64-w64-mingw32) of 2021-03-26 built on CIRROCUMULUS Repository revision: deef5efafb70f4b171265b896505b92b6eef24e6 Repository branch: HEAD Windowing system distributor 'Microsoft Corp.', version 10.0.19042 System Description: Microsoft Windows 10 Pro (v10.0.2009.19042.1348) Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Configured using: 'configure --without-dbus --host=3Dx86_64-w64-mingw32 --without-compress-install 'CFLAGS=3D-O2 -static''