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: Proposal: ls-lisp.el handle --group-directories-first flag Date: Fri, 16 Jul 2021 16:58:16 +0200 Message-ID: References: <8335se5v40.fsf@gnu.org> <83y2a64bla.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25454"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jul 16 16:59:00 2021 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 1m4PIp-0006Ph-Vo for ged-emacs-devel@m.gmane-mx.org; Fri, 16 Jul 2021 16:59:00 +0200 Original-Received: from localhost ([::1]:36772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4PIo-0001At-Ut for ged-emacs-devel@m.gmane-mx.org; Fri, 16 Jul 2021 10:58:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4PIF-0000Tv-6Z for emacs-devel@gnu.org; Fri, 16 Jul 2021 10:58:23 -0400 Original-Received: from mail-oln040092072047.outbound.protection.outlook.com ([40.92.72.47]:4299 helo=EUR03-VE1-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 1m4PIC-0000uz-LO; Fri, 16 Jul 2021 10:58:22 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WgQ0yOccSvPvBu7a58T2HF66+dLsyC76H29LoMEwj/Nl3ads/8gSTQfsLgAjhLIXIn4nCT+I8YD+R474VBwb7+9snBUGrFB5Mp/Bn8eD6X/rIQUz715HoKEwb5SubDVkUSuAdATkIa9EFAzt0zuQ74B9QhccSitPcok6s/cfpr25iUyj42BOk5WtErAz5j4XvNaphjg5c0K8MKkVctRmgYqqTRXJnwuWRzqS7kKb+3gzAEXDvG+g1qdB417nVWAtKJAQIUObINGRldBNQ9dVJc06SUy3w5QNaMgit+eXTtZ1Ds1geu2uefK4Fh0mDSPNCJ7JKnybMPEftCHWgf3LTQ== 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=PzAfEI9LEW2iUr8fsOSr3vOZ61dpRX35Y8Mj/asGDzQ=; b=TU0inxqwBYfMjrthPdPWC+4TQ3sJEoEHPr+GaiXN6bR1oRJcC7fuJtEr8Fi33XjcdPOlYpvOsK9tM1VG0amaEJ+w+8TD+PohuzawBtd7c00sJEq7IJHSSE8EZ4dL/Z1Z1psw7kJRZAN+PwSMuyTlBg2h7ciA9mPjdftrXZ0HpwGWbjCtE4FaC2sYjEL2ipjsZ1iL+c4Igi4M0C1L1McVpPvnQ88Qj48nIoFAuZBQXDCMeVE2kHfYnRj7Ic/mHGa2UHNPLnfMIc+rN0sy4eUWruH9e+7Ozj2fasyMC1RxpGTNJatCIz9e9VYBNE8YJiR6YglvJQQF26zrL2/D8SGKGQ== 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=PzAfEI9LEW2iUr8fsOSr3vOZ61dpRX35Y8Mj/asGDzQ=; b=TPBai8gbybeEYKVIvxgPkQKzWp/J0zIEZu86etzhRTcjxBOtXxLnpApNkktR5FmtRUlO8jo9hPfeZCuwAZOjJBKcvuD+1R9Ov/kTzM13jT/XwfwZZSyAGK4jygAS+zJ0eU4SZ9zod1JNpyidqvUdVhvzDddX+saqgKE0GajLqsDJwGvjX/ZjWQ9AbETE2SoMOckkSzjy63TccowI1VZiqzswAg2jNYgMChfwG5ZGujOgIWC1ElIKJeHyAGMGqPjd4AD8GIvVeBOvrWpgG5syo/VNX7uEXEXwbdUXg0M6ne0vdroNZWxrHzDlaMmdW5DY7av50srgAJM0gz3eFehtNQ== Original-Received: from VE1EUR03FT011.eop-EUR03.prod.protection.outlook.com (2a01:111:e400:7e09::40) by VE1EUR03HT063.eop-EUR03.prod.protection.outlook.com (2a01:111:e400:7e09::181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.26; Fri, 16 Jul 2021 14:58:17 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2a01:111:e400:7e09::53) by VE1EUR03FT011.mail.protection.outlook.com (2a01:111:e400:7e09::134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Fri, 16 Jul 2021 14:58:17 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:9222EF933E9BE875A74F4948537CBB54D336C9B804E9AD2ACD22F1F7AF8F9BC1; UpperCasedChecksum:57DA8AD21D9BA584BD2C0BC58E0A86D7B76465FE3673CC7759622072F531EFFF; SizeAsReceived:7604; Count:46 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::e47b:760e:fa35:f28b]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::e47b:760e:fa35:f28b%6]) with mapi id 15.20.4331.026; Fri, 16 Jul 2021 14:58:16 +0000 In-Reply-To: <83y2a64bla.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 16 Jul 2021 16:44:49 +0300") X-TMN: [PjzxQ/BrpR5FLw6g0aWdki2TA2WLt6US] X-ClientProxiedBy: AM5PR0701CA0058.eurprd07.prod.outlook.com (2603:10a6:203:2::20) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87h7gugvav.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by AM5PR0701CA0058.eurprd07.prod.outlook.com (2603:10a6:203:2::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.10 via Frontend Transport; Fri, 16 Jul 2021 14:58:16 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: eeb9c5be-3df6-4b32-5e2d-08d9486a2475 X-MS-TrafficTypeDiagnostic: VE1EUR03HT063: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: diwKVC3aEN2pz/xUKpPRhcqvzGmDuv2WZk97hhkWZDXzBr5CjPOixdf4V5wNdBeHssog5458DBmAMgl824COiSKtjPm7cIBlhWvbVDuUJ61B/HqvITZmsY1DiftVoe6AA7xoZdLVPWS84Q6GDmFWri85PcoRsX/ZX12QYa0RfKwD4rGx4gaxap9mkQ0zpS5pLFGPsBMm4XpaL2vydL8C5ROdj7LPLEwrs9kDTHSuaDmYSa71NP01lU6mua77q/Js8TbNNSibKbsJBJGKHGt0PbXeIncngx0P4fu0fGuZH7nbOzUyN4VvQ/fL4l6tXjsL3kpOvSuCBsP0xXB7Smo4MmUR6d2ANrU9IDsjRYhXceeRpMHcR2+0Dlmi3oT22AIHvLdO/+X19HlKxkNTYg2plwI2zBaWgGH6p+dmYcMLk1pttypd9VOuI+aKdB+4pFjV X-MS-Exchange-AntiSpam-MessageData: /ptGosmRi3Fr+ZVWtytxRCGidUREx9Nt/fL6EUY6Upe2OW4u/gVeHxfkxMZZaK5Mnr1lft5DHTyMfqJOrLWfXbJG9JRm+r316EqlAxLGdZ2KqCndpUwthEj/e6h/jEHpE5F1dgd8U2zjHeYmknLSDA== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: eeb9c5be-3df6-4b32-5e2d-08d9486a2475 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2021 14:58:16.8614 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT011.eop-EUR03.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: VE1EUR03HT063 Received-SPF: pass client-ip=40.92.72.47; envelope-from=arthur.miller@live.com; helo=EUR03-VE1-obe.outbound.protection.outlook.com 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:271308 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Arthur Miller >> Cc: emacs-devel@gnu.org >> Date: Fri, 16 Jul 2021 15:20:58 +0200 >> >> > Doesn't it work to let-bind ls-lisp-dirs-first? >> >> I don't know about that one. ls-lisp--insert-directory effectively >> ensures that switches are passed further the line as a string of >> chars. The flag is lost in the first step and can't be passed further >> on. > > Which flag is lost and why? Ok, I take my words back, it is actually not lost. I was to fast didn't reallize --group-directories-first was just converted with rest to a list of chars. Doesn't it mean that ls-lisp could potentialy recieve flags that user didn't ment to use? > I'm still missing something, because I don't see how this is different > from just let-binding ls-lisp-dirs-first. Since --group-directories-first is still there, then let bind works fine :-). --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=ls-lisp.patch --- ../emacs/lisp/ls-lisp.el 2021-06-06 23:11:38.317648694 +0200 +++ ./ls-lisp.el 2021-07-16 16:54:51.413276991 +0200 @@ -682,24 +682,27 @@ (ding) (sit-for 2)))) ; to show user the message! (if (memq ?F switches) ; classify switch (setq file-alist (mapcar 'ls-lisp-classify file-alist))) - (if ls-lisp-dirs-first - ;; Re-sort directories first, without otherwise changing the - ;; ordering, and reverse whole list. cadr of each element of - ;; `file-alist' is t for directory, string (name linked to) for - ;; symbolic link, or nil. - (let (el dirs files) - (while file-alist - (if (or (eq (cadr (setq el (car file-alist))) t) ; directory - (and (stringp (cadr el)) - (file-directory-p (cadr el)))) ; symlink to a directory - (setq dirs (cons el dirs)) - (setq files (cons el files))) - (setq file-alist (cdr file-alist))) - (setq file-alist - (if (memq ?U switches) ; unsorted order is reversed - (nconc dirs files) - (nconc files dirs) - )))) + (let ((dirs-first (or ls-lisp-dirs-first + (string-match "groupdirectoriesfirst" (concat + switches))))) + (if dirs-first + ;; Re-sort directories first, without otherwise changing the + ;; ordering, and reverse whole list. cadr of each element of + ;; `file-alist' is t for directory, string (name linked to) for + ;; symbolic link, or nil. + (let (el dirs files) + (while file-alist + (if (or (eq (cadr (setq el (car file-alist))) t) ; directory + (and (stringp (cadr el)) + (file-directory-p (cadr el)))) ; symlink to a directory + (setq dirs (cons el dirs)) + (setq files (cons el files))) + (setq file-alist (cdr file-alist))) + (setq file-alist + (if (memq ?U switches) ; unsorted order is reversed + (nconc dirs files) + (nconc files dirs) + ))))) ;; Finally reverse file alist if necessary. ;; (eq below MUST compare `(not (memq ...))' to force comparison of ;; t or nil, rather than list tails!) --=-=-=--