From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: empty-directory predicate, native implementation Date: Sun, 18 Oct 2020 14:06:30 +0200 Message-ID: <87ft6boi0p.fsf@gmx.de> References: <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="35870"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Eli Zaretskii , Drew Adams , emacs-devel@gnu.org To: Arthur Miller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Oct 18 14:10:22 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 1kU7W2-0009E0-8K for ged-emacs-devel@m.gmane-mx.org; Sun, 18 Oct 2020 14:10:22 +0200 Original-Received: from localhost ([::1]:54506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kU7W1-0001TY-1M for ged-emacs-devel@m.gmane-mx.org; Sun, 18 Oct 2020 08:10:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47708) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kU7SU-0000y8-VZ for emacs-devel@gnu.org; Sun, 18 Oct 2020 08:06:42 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:34075) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kU7SR-0003r8-RJ; Sun, 18 Oct 2020 08:06:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1603022792; bh=K6W9q4KEH/AEv3nlaEspQtta/HDzTOZ5WsjzmPw41WM=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=lqYhDMpZu68q0074dRrXNFWDCpx5tsjqHEdg3mHcm+Tl1HJZ/0aeLBULGnrCKnHay Xi+d75klsjRaDOSDq4L4qIMnU5QqlExXnXTaVYBbtUFZEK/A+rj9c33wcvtqJJx3jq APFpBhB/LqkSpuaaXYf4i5DjzSSlQJg2/TU3YSPM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([212.86.52.21]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MJVHe-1kjZuR3Qzo-00JqMN; Sun, 18 Oct 2020 14:06:31 +0200 In-Reply-To: (Arthur Miller's message of "Sat, 17 Oct 2020 23:58:29 +0200") X-Provags-ID: V03:K1:f3UliTvqn+7orGZ9jKG0puM93GaZLpedoTg9F1tqRmIbA/+ITdh v/1AFg/GFaRHci0s9+LKsLEXy/1OCp21Gr+QgBS5hPd+t5TFD+WgcKtWlNkXsHOeIR83cZz XXRkdPv4Hl/HMTEdQ6ZHjPvVn9jIZAFRqk5PGVrXVZfROywD1JvsBR/3zTOJpcHBfRl68wQ 7f9lbmoQCHPw5ZJT3SQ6Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:6bGmm9fsEmo=:0uVWgXfCRIo5kodH8+LKJD bpkfwoh8jFPr9HiA4Lou8rvAebPzs4EzVV2lkwb2XTt4E8PzBVMIuvIFC37YQ0jxzt3Wy0Jxx 3O7WpP4LAhatdsitgeyrb129uOrGaqiZK/icdT/l+HdHM4SulkzOe1br8A2Is4VO9HxBW0eDg YmmbVieiRT9oRzJ7ErMlmOFexU2kfpSh0IoxcnjYDpOP2Xi7LWfG84K0WiYjFMFTb8HyXMw/B TwLBFtJ0yTW1lKr4hI8qb4M5uDlvqExW/A3qwpWKAIFFRWIZDm/fbDpdxPgd1HEzK9HoMjFpt mQrbUdaByUtVySpBBjwoZH91xQALQsgx4u5xuf2X98zwMu/zfy1vhLP/+g+2H1GJsjmAC9HpV XWyW1XG9SYqyOCdt358wXWTWn8PhH67wj50PsrgSRGMgm6M81wW2VaEoXZ1LSJJCIrrU64guy KZ9TrteGClnFiUU0Ek20T2ZGmbtv14n9dS3tTB3P5e4kYRidzZCGdALOQjAWr/EJzLhMvQkUL CQaZQOL+1dutKrcVWAog5MAUpiJdEzX5rVZ8oXED8ZpaM5+Fs5H7P9+/LOpzRsP8UgkV4I295 FD9W+gWoeGiPjja+8IQYzIb6LBuA24UTBzCyZY2uiB/yswW4aMJr2Sd0Zns4KOU1ZzP5mXbmm 4BpkZi4UetMnrhpohbSOW4eoK7HWZF90uie3fO87zJgHRuf9mqQUg1MGIGGzMI6y8/DBCZDQ6 7M7VbMN2MhHIzd9iUuYQcjXKRgeqSd5UaZQxXhkHfFnpXrnNI3er6YvswjS+KMC/+xWHh03Z Received-SPF: pass client-ip=212.227.15.18; envelope-from=michael.albinus@gmx.de; helo=mout.gmx.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/18 08:06:37 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, 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: 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:258020 Archived-At: Arthur Miller writes: Hi, >> 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? I'm in line with Eli here. I have no glaring example that we need COUNT greater than one. Just a vague idea, that it could help to implement a more performant file name completion, especially in the remote case. That is, if you have a very large directory, you let complete file names on-the-fly (while typing in the minibuffer) with just the first 50 hits from directory-files, which could be retrieved much faster than, say, more than 2000 file names (this is what I have in /usr/bin). The complete file names for completion are retrieved, when the user hits TAB. Just a vague idea; I haven't checked how to implement. So I propose we still use the COUNT optional argument. This isn't worse than an argument NOT-EMPTY, which would let directory-files return immediately after the first hit has found. Best regards, Michael.