From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Re: empty-directory predicate, native implementation Date: Mon, 19 Oct 2020 02:24:03 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27155"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Eli Zaretskii , Michael Albinus , emacs-devel@gnu.org To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 19 02:24:51 2020 Return-path: Envelope-to: ged-emacs-devel@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 1kUIyp-0006vx-D4 for ged-emacs-devel@m.gmane-mx.org; Mon, 19 Oct 2020 02:24:51 +0200 Original-Received: from localhost ([::1]:50134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kUIyo-0007Xm-7D for ged-emacs-devel@m.gmane-mx.org; Sun, 18 Oct 2020 20:24:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kUIyB-00077g-8Y for emacs-devel@gnu.org; Sun, 18 Oct 2020 20:24:12 -0400 Original-Received: from mail-db8eur05olkn2070.outbound.protection.outlook.com ([40.92.89.70]:13537 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kUIy8-00011D-G9; Sun, 18 Oct 2020 20:24:10 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kcFM6HC+YT4WaDF9cEf8Ii5CePlz91s6zytslzGb5QRaYNX1d650PzSBC9dyYbWxwQovo7MWq9STKYZw/+IJ0+3YsiyMgVYB4oNLtiPiECT+HA8/G1LffHxE/JazAqREi9VJpLqpkPehHgbqMhLVvg47fG2ktTMwPJiOaYkKgIX/jWArV8Z4LvhTMGYhjEBVsL8UfmgY93+k1VBB9Egw42UYatW3GZnnTY5wpoH9viG6lsqgciyHiNEJ+cfGWdpOk7h8rrDRh14Zlt9jEy9h3Ppu4/fKyEj7GJRLFUTMJBsQ/RST9+Kop6Iy3wcxesnBsxJYjCuLrb4ddPnVDAnSLg== 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-SenderADCheck; bh=Sx/PkjJbHOG8eCC5BXp1ySIKA/vfS0iZZ1WsH1k95s0=; b=P7lISuRWza1Ca7AaXHwi3YTqS9iDhcXKxZz5sqyfF7pESGaceC+NPZtRLyRor1sr/udysCdjHs8ZEH8fIDWG6a8faKLylw0HUt4SZvugvr+VpOUzwsKJtb+lZYDJKezXITIUmM8evt7kMJEObTRsRX8eFFBY6ygV99qOMrU8IWiWCAot63afffzcyaMOpVRUKU0UY4pgUap12xvwvrxst9ncXUtHdcKu4WlT704jG7OBrFRVElQIlPI06GelQpYMTqOr3QelVAFKC7UczPO4MFE7ycxNmCUhS+RWIGL4x/4Hkz6HkbKMSWzaUGrMPwXLw9Etkc+Mb1qDCzuYZOtbEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Sx/PkjJbHOG8eCC5BXp1ySIKA/vfS0iZZ1WsH1k95s0=; b=SjiT953z9x1fdnzCVFuG+mdWHWnqEBl5EcjjY4TeP6fVgqDURcMrskQn5zeFk9c2AiQSjKnSb7CoDiT3i4PJ0frxHRKph4G8sIzga4qk2viFGWsXCJ1vIOUJ9F5q0bHmEXMmh9MXGerYJllUHtOz4AltQ6t4m+ldFdphgwwP6XUZYRYbhGWIhYKrfY/+xtxSFaKEFLriiZ3wVjgkNMupC0kNRVay0gv4i92isSZseoA1dXfT3Uq5xL90F4HAHArrFaHWC2tKLpXvkHwhcxNI+hU9TxMATwLdOWorGUyKvk1srZfag9ON2Ersk0gYTqXHOpfjSTk9gBZM8yWlxvFfiA== Original-Received: from AM6EUR05FT031.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc11::52) by AM6EUR05HT234.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc11::250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21; Mon, 19 Oct 2020 00:24:05 +0000 Original-Received: from VI1PR06MB4526.eurprd06.prod.outlook.com (2a01:111:e400:fc11::42) by AM6EUR05FT031.mail.protection.outlook.com (2a01:111:e400:fc11::151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Mon, 19 Oct 2020 00:24:05 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:ED4EDD9C56BC2BA5DC1C68320D55857C56CCD6487625F985D7AFB437279DD165; UpperCasedChecksum:C155364E62A64B91323F2D6C42FBD9B74F57F9F72A0A117BB05CB9E9802224D8; SizeAsReceived:7500; Count:46 Original-Received: from VI1PR06MB4526.eurprd06.prod.outlook.com ([fe80::187b:196a:cb2d:adf1]) by VI1PR06MB4526.eurprd06.prod.outlook.com ([fe80::187b:196a:cb2d:adf1%5]) with mapi id 15.20.3477.028; Mon, 19 Oct 2020 00:24:05 +0000 In-Reply-To: (Drew Adams's message of "Sun, 18 Oct 2020 14:13:43 -0700 (PDT)") X-TMN: [yX1VHq9shqeqVzNS7uZUBh3JgInQyNdQ] X-ClientProxiedBy: AM6P191CA0011.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:8b::24) To VI1PR06MB4526.eurprd06.prod.outlook.com (2603:10a6:803:ac::17) X-Microsoft-Original-Message-ID: <87pn5fqd0c.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (90.230.29.56) by AM6P191CA0011.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:8b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20 via Frontend Transport; Mon, 19 Oct 2020 00:24:04 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 4590b92d-5405-47b8-bd03-08d873c54951 X-MS-TrafficTypeDiagnostic: AM6EUR05HT234: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SkKeAYKbMo+wDNJgHHmgxS63QX0XLREfgiVh26DwRitambm0eny+Ba9UBcgZZiZZwkjEYrkY7dqXBeFiuOqFLKrWNOLrGwSVya2oWr45HsxLL+CrOuLWU4xaGuh38f73QZKPtMOa8viW4GkkkEeBxlAyiSLBmBGiwAseUT7jC1tYDrFBS54P0E/j2emuP7aiPoIWFIGDFnEKg2rCx1YADd1TSg2mP8PEZ/NVKVmtuf2TqqFkXRDaQugfKHShW07h X-MS-Exchange-AntiSpam-MessageData: waOnR4THD7JqM4/1ueuyfq/c3HAVQqXjN2RKeaad6ab7CDiKpkhjRNLXAyRkDM9dwVSXk1NN1O63pQEj/gzqx3NP7waFP3TQKnyJ5HdU13V71VOUvWZHpPxQs9VyLEnY0WnEu+aDdUDtgQamlPribQ== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4590b92d-5405-47b8-bd03-08d873c54951 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2020 00:24:05.4107 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: AM6EUR05FT031.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6EUR05HT234 Received-SPF: pass client-ip=40.92.89.70; envelope-from=arthur.miller@live.com; helo=EUR05-DB8-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/18 20:24:06 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:258073 Archived-At: Drew Adams writes: >> > `directory-files-no-dot-files-regexp' was added to Emacs 23. >> > Its value then was the same as that of `diredp-re-no-dot': >> > "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*". The value was >> > changed in Emacs 27, to "[^.]\\|\\.\\.\\.". >> > >> > For my purposes (Dired) I want the former, not the latter, >> > so `diredp-re-no-dot' remains the former. The two behave >> > quite differently. >> > >> > See https://urldefense.com/v3/__https://lists.gnu.org/archive/html/emacs- >> devel/2020- >> 04/msg00764.html__;!!GqivPVa7Brio!PWSpyl3EDfFC2LKEXIP7mdNKcGl6HzDDLwE2SFOWdxS >> ZaQ3phv5AVvVuUb-CN6kG$ >> >> FTR, I have also problems to understand how the current value of >> directory-files-no-dot-files-regexp works. But I fail to find a case >> where it is wrong. >> >> (string-match directory-files-no-dot-files-regexp ".") => nil >> (string-match directory-files-no-dot-files-regexp "..") => nil >> (string-match directory-files-no-dot-files-regexp ".a") => 1 >> (string-match directory-files-no-dot-files-regexp "..a") => 2 >> >> Could you pls give me an example which shows the problem with that >> constant? In case there is, I'll lobby for your request in the given >> message :-) > > Dunno. And perhaps I misspoke in saying they behave quite > differently. They _can_ behave quite differently, depending > on how they're used. > > And frankly I think that the only current Dired+ uses of the > regexp don't depend on the difference, as they all just pass > it to `directory-files' as the MATCH arg. And in that case > the new regexp is just as usable. > > In general, the difference between the two is this, AFAICT: > the old one (which is the one still used by Dired+) matches > the complete file name (the nondirectory part), whereas the > new one matches only enough of it to distinguish the . and > .. cases. > > IOW, what's different, AFAICS, is the match data: the match. > > So if you use the regexp only with `string-match-p' (which > doesn't care about the match data), or if you use it only > with `directory-files', then there's no real difference in > the effect. But if you use it for some context where the > matched parts are important, that is, where the match-data > matters, then there's a big difference. > > Perhaps in the past I used the regexp also for purposes of > grabbing the matched part(s). I don't recall. > > I didn't complain about Emacs changing the value of the > variable - no lobbying is needed. What I said was that > "it's not clear to me" why people were claiming that the > new regexp is "more correct" than the old one. (No one > ever responded to that, explaining in what way the old > one was somehow incorrect.) > > Paul's mail responding to my mail in that emacs-devel > thread says, BTW: > > As Drew's comments make evident, the doc string is > unclear. It should be something like 'Regexp that > matches part of a nonempty string if the string is > ^^^^^^^^^^^^ > neither "." nor "..".' > > But I couldn't find where in that thread I said that. > > Anyway, I've said it now. The old regexp matches all > chars in the nondir part of the file name. The new > regexp doesn't. The match data for the old regexp > gives you the matched name. But no, that's not > needed for `directory-file-names'. > ___ > > [BTW, neither manual nor doc string for `directory-files' > says what MATCH is matched against, other than "file names". > But apparently it's matched only against the nondirectory > part of file names, even if FULL is non-nil.] Thanks, that was really informative! Thank you for writing and explaining all that. I guess for purpose of tests and manual where I have used your regex, we can live with built-in one. Please ignore my other mail; I sent it before I red the rest of resonses. I am obviously to new here, so before I suggest something again :-), can I ask if you have already considered having a predicate as a filter function instead of regex? Is it considered as too much work to implement?