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: Thu, 15 Oct 2020 11:12:05 +0200 Message-ID: <87sgafq2e2.fsf@gmx.de> References: <83y2ka18t7.fsf@gnu.org> <87y2kaj799.fsf@gmx.de> <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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30679"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Arthur Miller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Oct 15 11:16:05 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 1kSzMh-0007sL-PG for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Oct 2020 11:16:03 +0200 Original-Received: from localhost ([::1]:35972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kSzMg-0007Nc-I8 for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Oct 2020 05:16:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32990) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSzJ0-0005zW-Pb for emacs-devel@gnu.org; Thu, 15 Oct 2020 05:12:14 -0400 Original-Received: from mout.gmx.net ([212.227.15.15]:35513) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSzIy-0004z1-2u; Thu, 15 Oct 2020 05:12:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1602753127; bh=if66xuuHLV4WuHlnZ/w78PsJ6OAufFnqeibg1uwiQTU=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=FgZYepUXrLYsIXE7PD7ArsxtcSZXUhsGDdfKGfuqwffWJd7bnTmFQ8DgU/q+Vg0oY oyUkYqqaY9SAt6OItHhAXN0j2Mu2PzWU3h7JrFnoDKLIsi8lMTscUgs/ucNfF6l0eI kV8YGcAxs42bh4lQYJeMqfrELKj24sSsdB64dyKk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([178.20.90.152]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MUosN-1ktlTy0Ljd-00QfmI; Thu, 15 Oct 2020 11:12:07 +0200 In-Reply-To: (Arthur Miller's message of "Thu, 15 Oct 2020 07:53:15 +0200") X-Provags-ID: V03:K1:tEWSvsITkTcexEdfSxvWQPjUUp7+srVikN20RgN0vLdCx3iwKHt uv9pkoWsiQyhgHLsNrF3qVIbv+kJ+mYI5qUz6gp7S8z+bFGAfsp1rrU0s6U+2FBOK4BNg1K xlfkptSyb8AI9vEnLD7/7lcl9gkvkyOm5su1lF/0kaOJZm0BxZVp4TyTFBtzPGDZOjsLr13 7aLwQcgaJIZGp4Mjxfd6A== X-UI-Out-Filterresults: notjunk:1;V03:K0:UhIT+SbRczo=:Ozmd46/17F3LqvIuyfXOqm cgQd0ZKQ9kj8/60tMWjx4EBIiqvHOcArYOW424jnY8kKcfZlcYKuo5U9lQgmaX2f5xR8VtdlZ TAZR8o1ArCy+ZbXtw+uIAFqtxW1zSsCSZJqQlQz5DFkaQGcHsOhhX+UC1VALDHjUCQHiguaSm pAp4TkIEehBmtZgsUSUejsQZmu44K8qu3QPXRm6fUR++oKSdSqo9Lp9PnFkZtNUnMZolSfy34 xA0YyuvSfBKqF6LmGfPnt9K5o6ujvoNxHRhPStAF1eFIsok6stgf7QEdAiLPt9E9kYoMjpACx 1JHAu+n5BChpP9maUGxb6tIBRZBCd/WS6O12wB41rbUup47zwhZqsGJbAHMDCYo5krkr4+rTa A9r1wYvmfmqQUC4YlATWPogJwq9D3wg47QFH0FJt4np81F302n3iknQSki3hYBrm8j1qec6yN mK9WVX3552dqdf7j6id5NKqDwLVKEaUPHOf1VMI+3gJ+U6EklDagAv05Z4yGGc51Xqg6zsLlD L51v46TatIc2jVqyT/0hSsNPDj/8+vpKfTYhV9U/varG44FeGyWqYzKTGVI++4hIJokHLBWKW NoH78eRNtU1ve+LlHhNv5KuDlLu6FMp88kAia7aTRtURo9eCw+NIknLhkjUaj537WfOAmuXvP oGJpqV3eBC5xaHszo123xZaVaxKfBOH1yVxT5ZHqnxe8EJ7lXesM+mTokTDu4oDIYOKX1cyvI oNJEl6d54ibv4QsnvGTCZzDge62I3nH8zIjosTm7RG72YPb12u0kL0sCjWxJ01gWHPcjayKz Received-SPF: pass client-ip=212.227.15.15; envelope-from=michael.albinus@gmx.de; helo=mout.gmx.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/15 05:12:08 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:257716 Archived-At: Arthur Miller writes: Hi Arthur, > Attached is patch which return nil early. Thanks for this. I haven't seen your name on the FSF file; I guess your legal papers are on the way? In the meantime, we could prepare the other changes. These are - Adapt the description of directory-files and directory-files-and-attributes in doc/lispref/files.texi. - Add an entry to etc/NEWS. - Adapt the file name handlers. These are ange-ftp-directory-files, ange-ftp-directory-files-and-attributes, tramp-handle-directory-files, tramp-handle-directory-files-and-attributes, tramp-adb-handle-directory-files-and-attributes, tramp-crypt-handle-directory-files, tramp-rclone-handle-directory-files, tramp-sh-handle-directory-files-and-attributes, tramp-smb-handle-directory-files. - Adapt resp extend ERT tests. These are tramp-test16-directory-files, tramp-test19-directory-files-and-attributes, tramp-archive-test16-directory-files and tramp-archive-test19-directory-files-and-attributes. - Optionally (but much appreciated), write new ERT tests for directory-files and directory-files-and-attributes. And here are some minor comments about your patch: > + if (FIXNATP(return_count)) > + { > + if (ind == last) > + break; > + ind ++; > + } > + Wouldn't it be more efficient to test if (!last && ind == last) break; ind ++; > +DEFUN ("directory-files", Fdirectory_files, Sdirectory_files, 1, 5, 0, > doc: /* Return a list of names of files in DIRECTORY. > There are three optional arguments: > If FULL is non-nil, return absolute file names. Otherwise return names > @@ -296,9 +312,14 @@ > If MATCH is non-nil, mention only file names that match the regexp MATCH. > If NOSORT is non-nil, the list is not sorted--its order is unpredictable. > Otherwise, the list returned is sorted with `string-lessp'. > - NOSORT is useful if you plan to sort the result yourself. */) > + NOSORT is useful if you plan to sort the result yourself. > +If COUNT is non-nil, the function will return max of COUNT and length > + files, where length is number of files in the directory. Order > + in which files are returned is not guaranteed and is file system and > + OS dependent. COUNT has to be an integral number in interval > + [1,COUNT]. If 0 files are requested the function will return nil. */) I know what you mean, but I had to read it twice in order to understand. Why not simply If COUNT is a natural number, the function will return up to COUNT files. > DEFUN ("directory-files-and-attributes", Fdirectory_files_and_attributes, > - Sdirectory_files_and_attributes, 1, 5, 0, > - doc: /* Return a list of names of files and their attributes in DIRECTORY. > + Sdirectory_files_and_attributes, 1, 6, 0, doc > + : /* Return a list of names of files and their attributes in DIRECTORY. > Value is a list of the form: > > - ((FILE1 . FILE1-ATTRS) (FILE2 . FILE2-ATTRS) ...) > +((FILE1 . FILE1-ATTRS) (FILE2 . FILE2-ATTRS) ...) Why do you remove the indentation? It is intentional, I believe. > This function accepts four optional arguments: > If FULL is non-nil, return absolute file names. Otherwise return names > - that are relative to the specified directory. > +that are relative to the specified directory. > If MATCH is non-nil, mention only file names that match the regexp MATCH. > If NOSORT is non-nil, the list is not sorted--its order is unpredictable. > - NOSORT is useful if you plan to sort the result yourself. > +NOSORT is useful if you plan to sort the result yourself. Same here. > +If COUNT is non-nil, the function will return max of COUNT and length > + files, where length is number of files in the directory. Order > + in which files are returned is not guaranteed and is file system and > + OS dependent. COUNT has to be an integral number in interval > + [1,COUNT]. If 0 files are requested the function will return nil. */) See above. Best regards, Michael.