From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.bugs Subject: bug#41250: 28.0.50; Dired displays unconditionally ls-switches on modeline Date: Mon, 18 May 2020 17:08:40 +0200 Message-ID: References: <87v9ky9p6o.fsf@mail.linkov.net> <654acc31-015d-4552-bd9b-3b8c69661fcd@default> <0957af50-7f85-455a-9d2c-e96451727872@default> <83a729uiaq.fsf@gnu.org> <835zcwv15e.fsf@gnu.org> <83wo5abngu.fsf@gnu.org> <83h7webjhy.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="32754"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 41250@debbugs.gnu.org, juri@linkov.net To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 18 17:09:17 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1jahOF-0008Pm-Ob for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 18 May 2020 17:09:15 +0200 Original-Received: from localhost ([::1]:57052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jahOE-0005pv-Rk for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 18 May 2020 11:09:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jahO2-0005pp-UZ for bug-gnu-emacs@gnu.org; Mon, 18 May 2020 11:09:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36503) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jahO2-0004v6-LZ for bug-gnu-emacs@gnu.org; Mon, 18 May 2020 11:09:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jahO2-00071T-GF for bug-gnu-emacs@gnu.org; Mon, 18 May 2020 11:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Arthur Miller Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 May 2020 15:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41250 X-GNU-PR-Package: emacs Original-Received: via spool by 41250-submit@debbugs.gnu.org id=B41250.158981453226979 (code B ref 41250); Mon, 18 May 2020 15:09:02 +0000 Original-Received: (at 41250) by debbugs.gnu.org; 18 May 2020 15:08:52 +0000 Original-Received: from localhost ([127.0.0.1]:48049 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jahNr-000715-VQ for submit@debbugs.gnu.org; Mon, 18 May 2020 11:08:52 -0400 Original-Received: from mail-oln040092068060.outbound.protection.outlook.com ([40.92.68.60]:19587 helo=EUR02-HE1-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jahNp-00070p-VS for 41250@debbugs.gnu.org; Mon, 18 May 2020 11:08:51 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SVFFxVOHsFXAyBGG6g+btXlP30M74ZOb5TLy18luY41c5gG42AS/F9/eN0jmEB6hJrzH+mrutJO0xvbLSWw366Vbm9HXh7LRzrwt5vL6JvetczRPBk6a/0yunJPq7ExqqxSFRWQNa/8d+ISz2bAY0BC+UJXXmAKOS94r1pQHX5FJMYjZTBgvfQsk38jVLC6fbe2VTuLDvkBVLkhYnFPmZsJ/nnLsiBjpD7cCetKeub3dCPb5ZuLZtX/gcDhpCfUNv46LuTDJgEaC6oBH9RiR1aaydyjOY/CGeCIG+RgJyrGF5ArSjvCXgJlfffiHNjO7iNpeYxWzt3mozlXb/NW4YA== 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=M3a/LXdJf8Mf+3zD54jf5mwkTXAQIGZmDSNFBM7wYv0=; b=NIBZf4k/xjpusEDfjoofPS3YEEXneOcTmowDzArmnDM+Yjjif3kHRa0olrfFrIQ3vCIozPTVu1u4mQ9Vb6pvphyod4yePzCP7wjR6wn4xg1dixqRiw4x/a7lyFfD7p0SeTJsS8+XGBkdS8l5QdK50+76aKkstku97m9ZKfu0K5bDDl29BIH9rVh6ZcXy/ChJVVbWWFIjx7ej0/rRxwZR5f/rMOyj587slyS0nYY03Zqg/Vnm9etNUy9Ew1zuGVgAc5VraLUo2nlH9jvnS4qt8ZlTBVqDxzJErZ58XX7jqL3HQMFwFAd5JKWv1WzWzrUvu92dCoqEBvmJg+SpDDOqcQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=live.com; dmarc=pass action=none header.from=live.com; dkim=pass header.d=live.com; 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=M3a/LXdJf8Mf+3zD54jf5mwkTXAQIGZmDSNFBM7wYv0=; b=p7z7er+WNnDhSkCnl63AqgpM7LDN+275X42ZmdTGbTTCzQbOD576SNHTc/ZmfzE0TSgu+32qcqgM5MNTOETK1zkzmSPi9G89zjTDcoUiW85hEv+Dzx8wAfbKxQHKhhdrrx6EW/JhZqbTH9UzwNsyEI+TM81+VZjlwVIotqH1TRYIJR36BNJ5ZCTkkze735PrN1KV1+gvDJwPcW+QksddL43hSrlg3ADTtx3vbYsOabSysDW/1Sjxht/qaNdeGy2ifqrL1zV8COV4I7E5lalk95a8L+t3pdf1d/PjdR0NPesq4t+h4EoUDtsQMYRx2VOS5urS4I02sfjotgBIcX/sMg== Original-Received: from AM5EUR02FT039.eop-EUR02.prod.protection.outlook.com (2a01:111:e400:7e1c::4e) by AM5EUR02HT092.eop-EUR02.prod.protection.outlook.com (2a01:111:e400:7e1c::402) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19; Mon, 18 May 2020 15:08:43 +0000 Original-Received: from VI1PR06MB4526.eurprd06.prod.outlook.com (2a01:111:e400:7e1c::44) by AM5EUR02FT039.mail.protection.outlook.com (2a01:111:e400:7e1c::283) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Mon, 18 May 2020 15:08:43 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:51AE97C21AB828FDC6E0B5FCA56E711528D9EBC7C41667F6CAFC2DEBD78C6D66; UpperCasedChecksum:5D6FDE07AD4031976A8285A24A8A7142F8CB8BB39464591C3BD568F1A2888BCC; SizeAsReceived:8443; Count:48 Original-Received: from VI1PR06MB4526.eurprd06.prod.outlook.com ([fe80::49f0:2314:a959:bec5]) by VI1PR06MB4526.eurprd06.prod.outlook.com ([fe80::49f0:2314:a959:bec5%7]) with mapi id 15.20.3000.034; Mon, 18 May 2020 15:08:43 +0000 In-Reply-To: (Stefan Kangas's message of "Sun, 17 May 2020 16:37:15 -0700") X-ClientProxiedBy: AM7PR04CA0015.eurprd04.prod.outlook.com (2603:10a6:20b:110::25) To VI1PR06MB4526.eurprd06.prod.outlook.com (2603:10a6:803:ac::17) X-Microsoft-Original-Message-ID: <877dx946x3.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (90.230.29.56) by AM7PR04CA0015.eurprd04.prod.outlook.com (2603:10a6:20b:110::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20 via Frontend Transport; Mon, 18 May 2020 15:08:41 +0000 X-Microsoft-Original-Message-ID: <877dx946x3.fsf@live.com> X-TMN: [NGQfV6kiit/4EEPV4+3JB3pZbYwYZE+v] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 297b0d02-dfa5-42a9-89d9-08d7fb3d59bd X-MS-TrafficTypeDiagnostic: AM5EUR02HT092: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tR3nrkxgfICOfqt8QKc15n5nk+MW3Q9lHs4gosI7LOEZeqNzvzpBEx6crRqX4RwVbU4CG4w1RLJnxOAxrFGky89HtiRK4zuJGa/qxuKYiEPTx2d62Mdu57H9b75EYqMB+JN5lLw/DDCDUj5lKlaAaFIgxoh5RTS7sAZ3nnjeUCGY7b3omVceMUJdKzPNaM10FXLPz71kbo9lctGfyFlA3g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:0; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR06MB4526.eurprd06.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:; DIR:OUT; SFP:1901; X-MS-Exchange-AntiSpam-MessageData: 9gyb0q7hLZj6VDqdtXYOkrxaboJRd6I4UCQ0qCZjGwt+GKgXssMCrwXGdl7tPzcDV4nTv34i2WiY7POMOCOSVRdtPF8JLB9AJoS5l+osRUYQa0WWeZOdfynMlZDqv2sKvDqhz7vUn3xZME/DlxJ/Ng== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: 297b0d02-dfa5-42a9-89d9-08d7fb3d59bd X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2020 15:08:43.1374 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5EUR02HT092 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:180543 Archived-At: --=-=-= Content-Type: text/plain Stefan Kangas writes: > Arthur Miller writes: > >> Another question: can I assume, at this time of civilisation >> development, that everybody has GNU ls, since binutils, or coreutils, or >> what is the name, is probably default on most *nix distros, as well as >> on msys2 which is needed to build on Windows. No idea how Mac people are >> doing in that regard though? > > MacOS has BSD userland, as does *BSD. > > You can install it and use GNU coreutils optionally, but I would expect > only a minority of users to do that. > > Best regards, > Stefan Kangas Alright, thanks. I can then either opt for status quo, as it is now (just date and name) or add extra sort options and bool flag in defcustom for users to enable if they now they have gnu ls. I could also add utility funciton to print version of ls in say message buffer. Anyway I have red the manual about propertize and seen some examples in code that Eli pointed me to, online aw well, and as I understand this feature (help-echo) is fairly trivial and easy to use. I like it, it seems really usefull. However, for some reason modeline ignores my propertized string :-). Below is another sketch for this. Instead of displaying actual switches, I display string "by user". I tested with elipsis at the end, "by user...", but I don't think it lookes so nice on modeline. The strategy is to show the tooltip with switches when user hoovers with pointer over the modeline (I completely missed that feature of Emacs since I use mouse and modeline so little :-)). Attached is a patch with this sketch, the only problem seems that I missundestand something, seems modeline does not display the tooltip. I am sorry for me being such noob, I will look around more, but if somebody can point out the misstake it will be helpful. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=dired.patch --- dired.el 2020-05-14 03:06:34.046112281 +0200 +++ lisp/dired.el 2020-05-18 13:37:21.934674831 +0200 @@ -223,6 +223,14 @@ (define-obsolete-variable-alias 'dired-free-space-args 'directory-free-space-args "27.1") +(defcustom dired-sort-mode-line-info t + "Run when dired is displaying it's info on modeline. Default hook is +dired-set-sort-mode-line, which displays sorting order used in current + dired buffer. Every hook in the list should return a string that + will be appended to dired info already shown on modeline." + :group 'dired + :type 'boolean) + ;;; Hook variables (defcustom dired-load-hook nil @@ -4114,24 +4122,43 @@ "Non-nil means the Dired sort command is disabled. The idea is to set this buffer-locally in special Dired buffers.") -(defun dired-sort-set-mode-line () - ;; Set mode line display according to dired-actual-switches. - ;; Mode line display of "by name" or "by date" guarantees the user a - ;; match with the corresponding regexps. Non-matching switches are - ;; shown literally. +(defun dired-set-mode-line () + ;; Flush dired info to mode-line (eval all dired-mode-line-hook) + ;; If dired-mode-line-hook is nil, it means user has manually + ;; disabled displaying of Dired info on mode-line, so let's respect + ;; the user decision. (when (eq major-mode 'dired-mode) - (setq mode-name - (let (case-fold-search) - (cond ((string-match-p - dired-sort-by-name-regexp dired-actual-switches) - "Dired by name") - ((string-match-p - dired-sort-by-date-regexp dired-actual-switches) - "Dired by date") - (t - (concat "Dired " dired-actual-switches))))) + (if dired-sort-mode-line-info + (setq mode-name + (concat + mode-name + (propertize + (dired-sort-set-mode-line) + 'help-echo dired-actual-switches))) + (setq mode-name "Dired")) ;; reset name if dired-mode-line-hook is nil (force-mode-line-update))) +(defun dired-sort-set-mode-line () + "Set mode line display according to dired-actual-switches. + Mode line display of \"by name\" or \"by date\" guarantees the user a + match with the corresponding regexps. Non-matching switches are + shown as \"by user\". has not disabled displaying them by + customizing dired-display-listing-switches variable." + (when (eq major-mode 'dired-mode) + (let* ((mode-line-info) + (case-fold-search)) + (cond ((string-match-p + dired-sort-by-name-regexp dired-actual-switches) + (setq mode-line-info " by name")) + + ((string-match-p + dired-sort-by-date-regexp dired-actual-switches) + (setq mode-line-info " by date")) + + (t + (setq mode-line-info " by user"))) + mode-line-info))) + (define-obsolete-function-alias 'dired-sort-set-modeline #'dired-sort-set-mode-line "24.3") @@ -4174,7 +4201,7 @@ dired-actual-switches) "t" " -t"))))) - (dired-sort-set-mode-line) + (dired-set-mode-line) (revert-buffer)) ;; Some user code loads dired especially for this. @@ -4197,7 +4224,7 @@ With optional second arg NO-REVERT, don't refresh the listing afterwards." (dired-sort-R-check switches) (setq dired-actual-switches switches) - (dired-sort-set-mode-line) + (dired-set-mode-line) (or no-revert (revert-buffer))) (defvar-local dired-subdir-alist-pre-R nil --=-=-=--