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: Sat, 17 Oct 2020 23:58:29 +0200 Message-ID: References: <83blh60wgr.fsf@gnu.org> <87h7qxjh7g.fsf@gmx.de> <878sc8kgy8.fsf@gmx.de> <87imbcls71.fsf@gmx.de> <83eem0zt0b.fsf@gnu.org> <87k0vsrd6m.fsf@gmx.de> <83a6wozs7h.fsf@gnu.org> <87sgafq2e2.fsf@gmx.de> <87h7qvptm3.fsf@gmx.de> <871rhxp8we.fsf@gmx.de> <237bd21b-96c7-4433-a5bc-34b64a9f4250@default> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7154"; 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 Sat Oct 17 23:59:47 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 1kTuEs-0001m5-Iy for ged-emacs-devel@m.gmane-mx.org; Sat, 17 Oct 2020 23:59:46 +0200 Original-Received: from localhost ([::1]:46434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kTuEr-0005fw-L6 for ged-emacs-devel@m.gmane-mx.org; Sat, 17 Oct 2020 17:59:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTuDj-0004kE-FD for emacs-devel@gnu.org; Sat, 17 Oct 2020 17:58:35 -0400 Original-Received: from mail-oln040092074027.outbound.protection.outlook.com ([40.92.74.27]:52602 helo=EUR04-DB3-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 1kTuDh-00059p-3d; Sat, 17 Oct 2020 17:58:34 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c7hppi6nli0zdpLYVzWvKMzznyOkGsb8ExlWiJfMQsWpX7tYy2Nar4w0NwYJ93EgBdqpockqBjA8g0GwKFyTXkWbfyDxNiIeyW2KS5LLPqENEODO7Ehh2noZzF2tmGM+L1X6d3ldstWmNu34K52wuEDcMsXUa+fVKqdhGS00hObjLQzllRzHf0tkgCvxXGzgaTaSCkAjEWmXQ7+KnU/tCc5CkKK7J6PYlmv5vsNhvM99bDWulasAT8hqgkWT6/wLXiwDiPy3I6XvOzW5r6R6NxLe7tQXG1gXeKpLGW0pmQXEPAob9sVrMP4nKeUTrCVMHjfM9F2x1oIBcKn10djafQ== 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=5tt5dATmwtzIayvYZPDgmmo8oT/sUEECRfbKlPHW+wY=; b=ihl7RdKYzLbj8yOBl7IElvkjqD53dXVRtDEIftPF9ekchW+SAyBghi6ZbUme6KvIzH/4TS+gny60Yc7/Ls9rc35hfsr/ZJX2xKKLgMqJdcRqJ12XgGEvvEalErtlE5k+0+IpJoaW97gmRV1dDp/y/qIZ44Huu5AzYGmWmqdRI9lypGSt4+OaIyLN4XuiwRUOMZk0jhMYtq+BzdRgJsiNKp+1U6Y7rBlSRBj5IePJqECg0UK/lzlNkh7bR4qWDaxSFK/bVh77r5UBaJ6S91QxSoXVUgHz/9+FwamL+Bi+WSZAc1RutSA1JB8ojgu9tNRffPvDKXwTAgJ2+jRATkm7nA== 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=5tt5dATmwtzIayvYZPDgmmo8oT/sUEECRfbKlPHW+wY=; b=XdFsdQQvs20svLGwt7HaQ3KbzYU98EtfySUwW5AOPg9nYx0RVbO1fWqNnyPpKKMZ5QHWuOuUYO0eCwzSq34mqw4ujZ3yS2qfOFWvXHq39ZNnXGWEXtU0nYOiGfpfYMhpVTHP06/8IuqKqn7Gnsb7y2BcsORBcoCILzfaoxzqfV1i9L87Y5syy1QXOkGN1fS7oc4WxfGYZqcdLh+utmjdKNiuKKjMxcHroVUZOXzryzitYQftLOZohGZwiPMcaEYjmKVrcswST0BO7SEb/8CutlwRhE7ZSzwJ3+cSoG2ciauCTqYxUOqvkNbk61nlU3XS+KT2xRoeB3XvMsB7CYTJyA== Original-Received: from HE1EUR04FT013.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::4c) by HE1EUR04HT220.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21; Sat, 17 Oct 2020 21:58:30 +0000 Original-Received: from VI1PR06MB4526.eurprd06.prod.outlook.com (2a01:111:e400:7e0d::41) by HE1EUR04FT013.mail.protection.outlook.com (2a01:111:e400:7e0d::126) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Sat, 17 Oct 2020 21:58:30 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:595EAEADA566FA7CA72D112CAFEA867A279F26B7C82A9B7FCE21249077C4D6A8; UpperCasedChecksum:C432528D68C0353D8D671D874CAC918B7993278E63D9FC771B964E7417FFD1C8; SizeAsReceived:8561; 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.023; Sat, 17 Oct 2020 21:58:30 +0000 In-Reply-To: (Drew Adams's message of "Sat, 17 Oct 2020 14:27:16 -0700 (PDT)") X-TMN: [sN1KsJ3JTieOgQAPNkFiwpNO/SzxWyZO] X-ClientProxiedBy: AM6PR0202CA0065.eurprd02.prod.outlook.com (2603:10a6:20b:3a::42) To VI1PR06MB4526.eurprd06.prod.outlook.com (2603:10a6:803:ac::17) X-Microsoft-Original-Message-ID: <87mu0k5xbu.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (90.230.29.56) by AM6PR0202CA0065.eurprd02.prod.outlook.com (2603:10a6:20b:3a::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Sat, 17 Oct 2020 21:58:29 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: fbf8ca9f-37ed-43d4-a70f-08d872e7c8a2 X-MS-TrafficTypeDiagnostic: HE1EUR04HT220: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EupeA2MEU6kZoYbTjbqCtev16q5HAnFjeyBnA+JSu7O9jLLZ+mAx67k5pw6mNO7/B7ILTmbAWNL8D0MkGjHfJwmLpWzjTioZURnjf3iaF7jSBYTCLgH/34ZlTSwU8gPdB8FlOEIl0DN+DCo2eXTfmcd1eJwQmeGGthmKty+6ockjuDP6CI12gqPdDwikZKL1/63PdMkZFZPjqG/8KO6dYQ== X-MS-Exchange-AntiSpam-MessageData: cerzmG84xPSFxFPdFNApwO22jDL9A0ftt/mNXEXZz0TzY0HQj1eLPO6Mo2fq/CWslDKkhIN2DOSDalqE1CpxLX0gqieozI3yJz2+4zq/TE1GzQoFbD4rNkStKIm4pgblzA8to/dfWJR57vFiPse6Tw== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: fbf8ca9f-37ed-43d4-a70f-08d872e7c8a2 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2020 21:58:30.5757 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: HE1EUR04FT013.eop-eur04.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: HE1EUR04HT220 Received-SPF: pass client-ip=40.92.74.27; envelope-from=arthur.miller@live.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/17 17:58:31 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:257977 Archived-At: Drew Adams writes: >> > Sorry I'm coming to this late. It's a long thread, >> > and I've only checked your patch, not the messages. >> > >> > I don't understand why we would do this. Is the >> > real aim to be able to have an empty-directory >> > predicate, i.e., to be able to see if there are >> > no files in a directory? >> >> I would just like to add to the previous mail; that this optimisation >> really does not matter on very first call... > > Believe me, I'm not trying to second-guess any > implementation. I haven't (and won't) look at the > C code, and I'm not very qualified to do so anyway. > > I was guessing that COUNT = 1 would be quicker for an > emptiness check than COUNT > 1 (e.g. COUNT = 80000). > > But my argument wasn't about implementation or > efficiency. Even if, for some reason, C had to "get" > (info about) all of the files in the directory, just > to determine whether the dir is empty, my argument > would be the same wrt Lisp: have a separate predicate, > or have a Boolean new parameter, instead of having a > COUNT new parameter. I am not sure I follow; but it is a building block to build that predicate. I agree with you that it is much nice to have such predicate built-in than if anyone is building their own if it is just one liner. I have no problems to build that predicate on directory_files_internal either, it is trivial; and it would remove need to change the function signature and count confusion, but than instead of changing one parameter in a signature it would be a new predicate in Lisp implementation. Wold be nice exercise to me to learn how to write a tramp handler :-), but I am not sure it is desired. Don't know, what Michael and Eli have to say about?