From: Arthur Miller <arthur.miller@live.com>
To: emacs-devel@gnu.org
Subject: Dired - ls-switches on Modeline
Date: Wed, 13 May 2020 11:10:54 +0200 [thread overview]
Message-ID: <VI1PR06MB452691DF590DBC8828F2CBB496BF0@VI1PR06MB4526.eurprd06.prod.outlook.com> (raw)
I use dired a lot, and I like to have two vertical windows to work with.
I try keep all my files 80 character wide lines. What I found a little
annoying is that dired automatically displays ls-switches on modeline.
If one has long switches line, like this one:
"-lA --si --time-style long-iso --group-directories-first"
then everything on modeline gets pushed far to the right. I haven't
found any way to turn this behavour off. The code responsible for this
is in dired.el, a function named "dired-sort-set-mode-line". There is a
condition always set to execute (t ...). Since it always call
"force-mode-line-update" after it adds ls-switches to dired, I don't
think it is even possible to advice it. The ony way for me was to hack
said function, and re-define it in my init file (I just added a variable
and change condition to check for it):
;; Prevent dired to write to modeline - it displays all the switches and pushes
;; everything far to the right.
(defvar dired-display-ls-switches nil
"Non-nil meands the Dired will display current ls-switches on modeline.")
(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.
(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")
((eq dired-display-ls-switches t)
(concat "Dired " dired-actual-switches)))))
(force-mode-line-update)))
I suggest as a usability improvement to add a user option to
enable/disable display of ls-switches on modeline, but if there is such
an option already, which I haven't discovered, then just ignore this :-).
next reply other threads:[~2020-05-13 9:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-13 9:10 Arthur Miller [this message]
2020-05-13 15:27 ` Dired - ls-switches on Modeline Drew Adams
2020-05-13 16:01 ` arthur miller
2020-05-14 1:31 ` Arthur Miller
2020-05-14 15:29 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=VI1PR06MB452691DF590DBC8828F2CBB496BF0@VI1PR06MB4526.eurprd06.prod.outlook.com \
--to=arthur.miller@live.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).