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: Proposal: ls-lisp.el handle --group-directories-first flag Date: Thu, 15 Jul 2021 11:19:52 +0200 Message-ID: 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="375"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jul 15 11:26:05 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 1m3xd5-000ARo-3i for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Jul 2021 11:26:03 +0200 Original-Received: from localhost ([::1]:39148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m3xd4-0004lj-5e for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Jul 2021 05:26:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3xc2-00042w-Gg for emacs-devel@gnu.org; Thu, 15 Jul 2021 05:24:58 -0400 Original-Received: from mail-vi1eur04olkn0803.outbound.protection.outlook.com ([2a01:111:f400:fe0e::803]:6441 helo=EUR04-VI1-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 1m3xc0-0001iG-Bk for emacs-devel@gnu.org; Thu, 15 Jul 2021 05:24:58 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IbTc6ZuvCvWdPnsjXjk5yOFjWs6zE/wMHNgJl+UeqPI+yE0rqbdEsk9k7tAkibK6iJrA5FPKA6KcEpxU2wfntok+NrsKrwFOBqs9haNeRnYB3sNrPerGyGtbTAkU40qUhhSFXibfZND7sH6/GyhXibcu1Zd9goqL3PT6NhOSENC4kkwTgTuvgxma+ZlVS84GVaN2Zb6R0+/En1qLeB7TyC/l1ZSC2YG8sbfXZvy0827Pc5jTzoIcIzmsipWPDNZCuKVpK07gpX2LnwNvk2u5Zfgq7EnqDSPKMNJDpRuDD2c6bbAtKvm/qPiQ5wh5RhtG2frYnaTPv4McTzA2rZjWDg== 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=pscb6qrjo3R3uCYUsPgi9oTjnXH7D6unQMVdV/FwFPQ=; b=feXSq0DO51LsqTUp0ZDkSG2U061lBe7GxhOrBsYB8tUI2cZd/ZXpn4oO+o2a/QjetCONAhZnTon9gqAHsWSJpJ6yzWGGMV5qiIPtok8zxfKzpxzldOqDO6+T5cTp6NjROYZ80pDmKafjfDjpuZUUrLX4/ZdNVvSEkkYUlOSbQpvvguxcXAWtPyPUpUUWHiXhSBGQQFqwh4lFT2E9tmNfjpDEktWqQNkCux84hStjtAPbb/r5/O76kQxdGILyuD39F4uNKGQ4HPp6OeTE3VM/5iX5JMKDy7YhM5uvhBdVHPFGuOhZAlNTd0lYq3iC45JeJGSq3aJYditkrn2l9UwPwQ== 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=pscb6qrjo3R3uCYUsPgi9oTjnXH7D6unQMVdV/FwFPQ=; b=hJUF4Kgozg3GdqmLS+3YjS2TFzCoCnl8twMNGZ0WwQQwesEfQ2usY11M2JhsM1hhvV6VC6PVcLTHSpyixkd6t0Xb0KF1dzr1tPrFptXJpeJKnmcGX/JZZikydz63yblyuMWFCcBeDXNzjHo/93U/KSY0Ib2oXY9EBRmZf3SNzqjsSayK45iSV6r504i/3O41rjGIOW8QApw0wYa4qs1Cg5Gvd5TBS3UZymzM/3Y0GfOCo11oIXuGNQNRdLLIz8tUfObVFNJkUr6tHWPr51WvXFpxTsJmaKvNuFw8hdnzS9o8aho08aeJ+51NZB80i0moCsHIl/8rKqbWvsmcrUf4gw== Original-Received: from VI1EUR04FT052.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0e::40) by VI1EUR04HT013.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0e::355) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.20; Thu, 15 Jul 2021 09:19:53 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2a01:111:e400:7e0e::41) by VI1EUR04FT052.mail.protection.outlook.com (2a01:111:e400:7e0e::397) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Thu, 15 Jul 2021 09:19:53 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:C40565FFE8DA614D6A37BE07B4060FF1D68CEF3227B6E99AF9A2AA09DC01EB83; UpperCasedChecksum:8276EB8D82C97C94F4F093C67D2566B7DA05051CF8DDD43806CA6F43EE232844; SizeAsReceived:7227; Count:43 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.024; Thu, 15 Jul 2021 09:19:53 +0000 X-TMN: [Doa1rw7DUbruVX6HtQceDJlxU75AlX6Q] X-ClientProxiedBy: AM5PR0701CA0011.eurprd07.prod.outlook.com (2603:10a6:203:51::21) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87zguondc7.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by AM5PR0701CA0011.eurprd07.prod.outlook.com (2603:10a6:203:51::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.10 via Frontend Transport; Thu, 15 Jul 2021 09:19:52 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 43 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 770acb2f-20ee-4d0d-a561-08d94771b3e1 X-MS-TrafficTypeDiagnostic: VI1EUR04HT013: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rz/2i4QhQhUvOqX8lT6UwoA+R5S9KjusTaP8AWrNTE/40sDsj4wwz7P9PZRTrtVP+Z070VqigroW9MKjUutvMu3S6O7XzASvRzpwhnpBZmblF5nctTQC4Jfu6nfWh1FinYsDrFMkr8cyuDSHmeoeVMmGKXc6ag+WJ1SBLbY9cwixi3uqgmtzyFQ+UuQphh9PqIqIjhy4gIEddU3qYNdUvwGCLGx4jCgfSl58UNG/0BflsbF+Our9+a3EePiGYTqyyvzstYeMlqr/o+ebkp3ZGGcGYYe1ZZaDwtEXPG8MphSnxmItd1qHU/QDQ0glxJYOiVDef9sWmNEGL2vzD9Y2yDidfFz/H+DpEeHU4wIhFoodDux+ZBbkJrAlojQbn1dBhUo8LDYHbDc4wAAR2bSVoC0aLraM/lM3FRn/xGxTJWhKuMK7ZteCIjd4L/jkE3KZ X-MS-Exchange-AntiSpam-MessageData: 6MsW2q4tqSE+WQDLC4uD/zvXmDvV1ytScJBpjISeji803hpdBcfq9MNkVzH4jyHTHaxo4FX6ZGckyn7S2AySKcWHVJK2j56EdYY/9dGROefTwSwFm0AjMWCNnBawjOiRTB0iq9fCN5HjblfwfszGTw== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: 770acb2f-20ee-4d0d-a561-08d94771b3e1 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2021 09:19:53.0614 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: VI1EUR04FT052.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: VI1EUR04HT013 Received-SPF: pass client-ip=2a01:111:f400:fe0e::803; envelope-from=arthur.miller@live.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: 6 X-Spam_score: 0.6 X-Spam_bar: / X-Spam_report: (0.6 / 5.0 requ) BAYES_50=0.8, 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, 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:271238 Archived-At: --=-=-= Content-Type: text/plain Just a minor 'out-of-the-box' quality of life improvement mostly for MS Windows users. ls-lisp.el is default on MS Windows, and some users might share their init configuration between their Gnu/Linux and MS Windows systems, it might be nice to have ls-lisp.el recognize `--group-directories-first' flag of Gnu ls program. I have just piggy-back on existing code here; I am not sure if I can actually set `ls-lisp-dirs-firs' var to `t' when `--group-directories-first' is found, so I am just converting this flag to `y' so we can per-use existing machinery. But I would happily skip `y' if it is acceptable to change users choice for `ls-lisp-dirs-first' variable when `--group-directories-first' is present. If this would be acceptable, I can also add some notice to docs and news. --=-=-= 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-15 11:08:02.233434792 +0200 @@ -291,6 +291,10 @@ ;; Remove --dired switch (if (string-match "--dired " switches) (setq switches (replace-match "" nil nil switches))) + ;; Convert --group-directories-first to `y' (`y' and `Y' does not seem to + ;; be used by any ls prog currently so we can per-use it here) + (if (string-match "--group-directories-first " switches) + (setq switches (replace-match "y" nil nil switches))) ;; Convert SWITCHES to a list of characters. (setq switches (delete ?\ (delete ?- (append switches nil)))) ;; Sometimes we get ".../foo*/" as FILE. While the shell and @@ -682,7 +686,7 @@ (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 + (if (or ls-lisp-dirs-first (memq ?y switches)) ;; 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 --=-=-=--