--- 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.