unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#41250: 28.0.50; Dired displays unconditionally ls-switches on modeline
@ 2020-05-14  1:42 Arthur Miller
  2020-05-14 22:33 ` Juri Linkov
  2020-10-06 11:36 ` Mattias Engdegård
  0 siblings, 2 replies; 79+ messages in thread
From: Arthur Miller @ 2020-05-14  1:42 UTC (permalink / raw)
  To: 41250

[-- Attachment #1: Type: text/plain, Size: 863 bytes --]


There is no way to turn off displaying of ls-switches on modeline when
in dired-mode.

By default in certain configuration, dired display ls-switches on
modeline. In case those switches are a long list, for example:

"-lA --si --time-style long-iso --group-directories-first"

then everything else on modeline gets pushed far to the right which is
not very usable. In general I don't have much use of seing ls-switches
on modeline and would like to be able to turn them off. As of current it
does not seem possible since it is hard-coded in function
`dired-sort-set-mode-line' in dired.el.

I suggest, as small improvement, to introduce a user option to turn off
or on displaying of ls-switches on modeline. As a suggestion I have
attached small hack to dired.el as tested on my copy of Emacs, but you
might wish to rewrite it. Drew had some other suggestions.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch to introduce user option to turn on/off for --]
[-- Type: text/x-patch, Size: 2497 bytes --]

--- dired.el	2020-05-14 03:06:34.046112281 +0200
+++ lisp/dired.el	2020-05-14 03:12:03.423097577 +0200
@@ -70,12 +70,20 @@
   :type 'string
   :group 'dired)
 
+(defcustom dired-display-listing-switches nil
+  "Display switches passed to `ls' for Dired on modeline.
+If value is `t', value of dired-listing-switches will be shown on
+modeline, when dired is not showing files `by name' or `by date'.
+Default value is nil."
+  :type 'boolean
+  :group 'dired)
+
 (defcustom dired-subdir-switches nil
   "If non-nil, switches passed to `ls' for inserting subdirectories.
 If nil, `dired-listing-switches' is used."
-   :group 'dired
-   :type '(choice (const :tag "Use dired-listing-switches" nil)
-                  (string :tag "Switches")))
+  :group 'dired
+  :type '(choice (const :tag "Use dired-listing-switches" nil)
+                 (string :tag "Switches")))
 
 (defcustom dired-chown-program
   (purecopy (cond ((executable-find "chown") "chown")
@@ -4118,22 +4126,25 @@
   ;; 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.
+  ;; shown literally if user has not disabled displaying them by
+  ;; customizing dired-display-listing-switches variable.
   (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)))))
+    (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")
+	          ((eq dired-display-listing-switches t)
+	           (concat "Dired " dired-actual-switches))
+                  (t
+                   "Dired"))))
     (force-mode-line-update)))
 
-(define-obsolete-function-alias 'dired-sort-set-modeline
-  #'dired-sort-set-mode-line "24.3")
+  (define-obsolete-function-alias 'dired-sort-set-modeline
+    #'dired-sort-set-mode-line "24.3")
 
 (defun dired-sort-toggle-or-edit (&optional arg)
   "Toggle sorting by date, and refresh the Dired buffer.

^ permalink raw reply	[flat|nested] 79+ messages in thread
[parent not found: <<VI1PR06MB45265DF0191578C413A3B37C96BC0@VI1PR06MB4526.eurprd06.prod.outlook.com>]

end of thread, other threads:[~2020-10-06 13:28 UTC | newest]

Thread overview: 79+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14  1:42 bug#41250: 28.0.50; Dired displays unconditionally ls-switches on modeline Arthur Miller
2020-05-14 22:33 ` Juri Linkov
2020-05-14 23:42   ` Drew Adams
2020-05-15  8:44     ` Arthur Miller
2020-05-15 18:55       ` Drew Adams
2020-05-15 19:09         ` Eli Zaretskii
2020-05-15 21:08           ` Arthur Miller
2020-05-15 22:19             ` Drew Adams
2020-05-17  3:09               ` Arthur Miller
2020-05-17  6:59                 ` Drew Adams
2020-05-17 11:12                   ` Arthur Miller
2020-05-16  6:34             ` Eli Zaretskii
2020-05-16 12:18               ` Arthur Miller
2020-05-17  3:01               ` Arthur Miller
2020-05-17 15:17                 ` Eli Zaretskii
2020-05-17 16:34                   ` Arthur Miller
2020-05-17 16:42                     ` Eli Zaretskii
2020-05-17 22:57                       ` Arthur Miller
2020-05-17 23:37                         ` Stefan Kangas
2020-05-18 15:08                           ` Arthur Miller
2020-05-18 14:25                         ` Eli Zaretskii
     [not found]           ` <<VI1PR06MB4526BAF92DBDCEA6A75D7A0196BD0@VI1PR06MB4526.eurprd06.prod.outlook.com>
     [not found]             ` <<835zcwv15e.fsf@gnu.org>
2020-05-16 14:42               ` Drew Adams
2020-05-15 19:54         ` Arthur Miller
2020-05-15 22:19           ` Drew Adams
2020-05-15 22:24             ` Drew Adams
2020-09-30 16:02               ` Lars Ingebrigtsen
2020-09-30 19:04                 ` Juri Linkov
2020-09-30 19:30                   ` Lars Ingebrigtsen
2020-09-30 19:58                     ` Juri Linkov
2020-09-30 19:59                       ` Lars Ingebrigtsen
2020-10-01 19:37                         ` Juri Linkov
2020-10-01 19:59                           ` Lars Ingebrigtsen
2020-10-02  6:31                             ` Eli Zaretskii
2020-10-02 14:10                               ` Lars Ingebrigtsen
2020-10-02 14:57                                 ` Eli Zaretskii
2020-10-03 17:36                                   ` Lars Ingebrigtsen
2020-10-02  6:54                             ` Juri Linkov
2020-10-02 14:14                               ` Lars Ingebrigtsen
2020-10-02 14:59                                 ` Eli Zaretskii
2020-10-03 17:38                                   ` Lars Ingebrigtsen
2020-10-04 19:44                                 ` Juri Linkov
2020-10-05  7:08                                   ` Lars Ingebrigtsen
2020-10-05 20:15                                     ` Juri Linkov
2020-10-06  1:37                                       ` Lars Ingebrigtsen
2020-10-05 15:49                                   ` Glenn Morris
2020-10-05 20:12                                     ` Juri Linkov
2020-10-05 21:31                                       ` Andreas Schwab
2020-10-06 13:08                                         ` Stefan Monnier
2020-10-06 13:28                                           ` Andreas Schwab
2020-10-05 23:06                                       ` Glenn Morris
2020-10-06  7:13                                         ` Andreas Schwab
2020-10-06  7:18                                           ` Eli Zaretskii
2020-10-06  7:28                                             ` Eli Zaretskii
2020-10-06  7:48                                               ` Andreas Schwab
2020-10-06  8:18                                                 ` Eli Zaretskii
2020-10-06  8:44                                                   ` Andreas Schwab
2020-10-06  9:03                                                     ` Eli Zaretskii
2020-10-06  9:17                                                       ` Andreas Schwab
2020-10-06  9:24                                                         ` Eli Zaretskii
2020-10-06  9:45                                                           ` Andreas Schwab
2020-10-06  7:52                                             ` Juri Linkov
2020-10-01 20:01                           ` Lars Ingebrigtsen
2020-10-01  2:30                     ` Eli Zaretskii
2020-10-01  2:39                       ` Lars Ingebrigtsen
2020-10-01  9:24                         ` Andy Moreton
2020-09-30 21:07                   ` Drew Adams
2020-10-01  1:25                     ` Lars Ingebrigtsen
2020-10-01 16:35                       ` Drew Adams
2020-09-30 20:56                 ` Drew Adams
2020-05-16 23:11         ` Juri Linkov
2020-05-17  1:16           ` Drew Adams
2020-05-15  6:43   ` Eli Zaretskii
2020-05-15  8:40     ` Arthur Miller
2020-05-15 10:15       ` Eli Zaretskii
2020-05-15 10:50         ` Arthur Miller
2020-10-06 11:36 ` Mattias Engdegård
     [not found] <<VI1PR06MB45265DF0191578C413A3B37C96BC0@VI1PR06MB4526.eurprd06.prod.outlook.com>
     [not found] ` <<87v9ky9p6o.fsf@mail.linkov.net>
     [not found]   ` <<654acc31-015d-4552-bd9b-3b8c69661fcd@default>
     [not found]     ` <<VI1PR06MB45265603DFF6BE71DBD819EB96BD0@VI1PR06MB4526.eurprd06.prod.outlook.com>
     [not found]       ` <<0957af50-7f85-455a-9d2c-e96451727872@default>
     [not found]         ` <<83a729uiaq.fsf@gnu.org>
2020-05-15 21:00           ` Drew Adams
2020-05-15 21:14             ` Arthur Miller
2020-05-15 22:04             ` Drew Adams

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).