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: Thu, 15 Oct 2020 13:33:54 +0200 Message-ID: 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> <87sgafq2e2.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6630"; 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: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Oct 15 13:35:09 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 1kT1XJ-0001c4-5E for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Oct 2020 13:35:09 +0200 Original-Received: from localhost ([::1]:41454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kT1XI-00063w-4P for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Oct 2020 07:35:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50170) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kT1Wh-0005Ys-4r for emacs-devel@gnu.org; Thu, 15 Oct 2020 07:34:31 -0400 Original-Received: from mail-oln040092074056.outbound.protection.outlook.com ([40.92.74.56]:2115 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 1kT1WC-0000nl-EU; Thu, 15 Oct 2020 07:34:30 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gAj8pDpmVB83GiE0cz0hSdKBRkjL47IyphebE3RtadCEzNzmZV7hlIFWoM3sdXm+y3AplXlmqKPkKnphwHQZYmM+ylPMn2yBcOQrur1o5ksQLE6idH4OOWtGWi6bYjq2c6/gD++I85VSqXbxhC8Nl/jBwGnzztOk6KOt8OiQFqIAyp50E3KVrX+xipkxiqlkj0n28aClbb1mFw9KDKIeTqviOwNBDUKDyAyXkqPD2ThnKKlmQDPM8O6pl+PsXaDrORYa1xfFcr1e3dbH8nDjsJgfsFP07B0gE+pwvPCunECr4KCV90bfu5jUbdM+bwi7yB2vX0bQtl73SZiQ9kDnqg== 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=hi43OwA3h18LiaDASPMLc4cBB+247eTJwQ3uWoxLels=; b=bivd49WqywBdfNpNl5X6B54w1vAFbeC8/PGeIJw9TRXeJzxUY+3cTSA3krOHI1RMvRYBdVbPtCUr5EjSSCji5yONe14SW5zm7PkDTz62NkIBAvmUjP2Knl3eIJzwTK6HBwdjfMp1e/AlvExBGHg5HESmddhXNoJYVWDqNTKrn7f02KdWWvB0eJvPonjz1VxLCy1b+PrwsSIja4P36egfYZoofGUssm2sqXzEiDL4mNCDtZF4xb3tBMLt6m3abrYtpI10nwav+6JBtA8NFLx/k13XTnwd0uVFxo3L9Zxwhr+i4jYxv3RmjHX+TUXo5G0zxsRidy5YShPREo3j5hux7Q== 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=hi43OwA3h18LiaDASPMLc4cBB+247eTJwQ3uWoxLels=; b=rUkEoi/dE65ldZA2vubJEziJ9Y6ODq67G6ulA8Su2wUcAk6ZDiLkHGEO+/pQ8sQuT27qMClKKIpEEdfH9sgIMrsEopiYgXD4LqWsox3cvmfmT42qNMiiCpvLhDFWHtSiPUSI7fThMbcJsLnPg8Xnwq7I9NAfml/vukHtoNhI6TMtw86VrXelP1hVZYQsmPl7Or1jyMu9bn6URUJ1m+bFRdIsTyJkw+5zXrag/7qm2vGBPNLrNfjoMbUqnJlT6UB+yAC5F2bMjGN7x3Smoyjs/k0Py3wMCy3CsXlAtfTokqVmFdS1xMdI+3uqrOngJHwlIMRMLDRVpS/kzGyXHhBRxg== Original-Received: from DB3EUR04FT060.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0c::44) by DB3EUR04HT073.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0c::331) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21; Thu, 15 Oct 2020 11:33:56 +0000 Original-Received: from AM6PR06MB4518.eurprd06.prod.outlook.com (2a01:111:e400:7e0c::4c) by DB3EUR04FT060.mail.protection.outlook.com (2a01:111:e400:7e0c::224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Thu, 15 Oct 2020 11:33:56 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:B56768266FA43CA7CFD41508369158879DF9DECBB6219AA9D720A3FEA07C52B5; UpperCasedChecksum:73283850A7CC1DFA6AB4D06F6A44DDA3B6FF668C35C2F5C81402513BC698C497; SizeAsReceived:8061; Count:46 Original-Received: from AM6PR06MB4518.eurprd06.prod.outlook.com ([fe80::bcb9:3133:8a66:dc8e]) by AM6PR06MB4518.eurprd06.prod.outlook.com ([fe80::bcb9:3133:8a66:dc8e%6]) with mapi id 15.20.3477.021; Thu, 15 Oct 2020 11:33:56 +0000 In-Reply-To: <87sgafq2e2.fsf@gmx.de> (Michael Albinus's message of "Thu, 15 Oct 2020 11:12:05 +0200") X-TMN: [Ak6SAbG96K2+OK6FOFeoJDEyPl975R7g] X-ClientProxiedBy: AM6P191CA0068.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::45) To AM6PR06MB4518.eurprd06.prod.outlook.com (2603:10a6:20b:6b::13) X-Microsoft-Original-Message-ID: <87o8l3vi3h.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (90.230.29.56) by AM6P191CA0068.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.22 via Frontend Transport; Thu, 15 Oct 2020 11:33:55 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 81dfbe18-ac24-4e6c-e204-08d870fe3315 X-MS-TrafficTypeDiagnostic: DB3EUR04HT073: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rw5K9++b4AoaMEAiPEjeHmyC9voQa0GB/8ExOvPbf3hWxSJa2xvXlaA0dwLCFQB4JK/EfmyIuQa6Ui0swaRx2oU2ySCmhE6kgG/nL0XK1B+RRDczELS7WJRnp+TbwX2i1sLnAug+vLJqU9kG/2H9x3M3jPvfId3VSox5nH+u5cm905uXp1LmZv++YjfSS1LgZ4efx2r+hRVZ5iukY1+e+Y2tTo1I2e8scMx1BQ87NkiMaUqqlzIZxqM8I41uYgw8 X-MS-Exchange-AntiSpam-MessageData: OAbjqP0KZt6BQqXy4ojUOiroDZs+6DjyJISa47o1uosNwunK1/nN2Eit5hagnl2IaquYkXn2dxPh6unyms/pgJwK5uTcMGkezao/G2gueVnkXKjwS2fQYhSDnK8XsPl5A9wa3ykHs7sodxWvJj9DtA== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81dfbe18-ac24-4e6c-e204-08d870fe3315 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2020 11:33:56.0947 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DB3EUR04FT060.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: DB3EUR04HT073 Received-SPF: pass client-ip=40.92.74.56; 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/15 07:33:57 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:257717 Archived-At: Michael Albinus writes: > 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? They are not, but they can be if someone send me link. I've been looking at this page: https://www.gnu.org/prep/maintain/html_node/Copyright-Papers.html#Copyright-Papers but I am not really sure where do I send request. > 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. Aha, so it is how it works; didn't have time to look into tramp yet. Ok, I'll do; I'll sent in patch(es) when I am done. Probably not today though but during the weekend of beginning of the next week. So many changes just for one signature :-). > - 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. Will have to look at ERT, I suppose it is not too complicated, opportunity to learn it. > 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 ++; It will :-) I mainly try to be clear "what I intent" for some future reader; since previous code uses lisp.h macros, I used same. I thought that one extra 'if' is not that much of a penalty, I'll gladly shortcircut with !last. >> +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. I was thinking myself that the last argument took as much doc-space as comment for the rest of entire function :-). I tried to be as no-doubt-clear as well as not-so-mathematical, but I definitely think your version is much nicer. We go with that. >> 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. I don't. It is my Emacs. I have by defualt "linux" as identation style; and changed to "gnu" and even setq default, but Emacs arsed about identing "linux" style anyway; so I "manually" idented everything I sent in that changed, and I have just missed those since I didn't edited those at all.