* Dired - ls-switches on Modeline @ 2020-05-13 9:10 Arthur Miller 2020-05-13 15:27 ` Drew Adams 0 siblings, 1 reply; 5+ messages in thread From: Arthur Miller @ 2020-05-13 9:10 UTC (permalink / raw) To: emacs-devel 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 :-). ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Dired - ls-switches on Modeline 2020-05-13 9:10 Dired - ls-switches on Modeline Arthur Miller @ 2020-05-13 15:27 ` Drew Adams 2020-05-13 16:01 ` arthur miller 2020-05-14 1:31 ` Arthur Miller 0 siblings, 2 replies; 5+ messages in thread From: Drew Adams @ 2020-05-13 15:27 UTC (permalink / raw) To: Arthur Miller, emacs-devel > I suggest as a usability improvement to add a user option to > enable/disable display of ls-switches on modeline Sounds good to me. E.g. A user option whose value is a format string that accepts the value of `dired-actual-switches' and returns the text to use in the mode-line. Trivial to do. You might want to file an enhancement request for this (`M-x report-emacs-bug'). ___ If the request doesn't get accepted for some reason then perhaps I'll do it for Dired+.el. I already add additional info to the mode-line (on a hook, so you can remove it): -- Show number of marked, flagged, and current-list lines in mode-line. (Flagged means flagged for deletion.) If the current line is marked/flagged and there are others marked/flagged after it then show `N/M', where `N' is the number marked/flagged through the current line and `M' is the total number marked/flagged. If the current line is for a file then show `L/T', where `L' is the line number in the current listing and `T' is the number of files in that listing. If option `diredp-count-.-and-..-flag' is non-nil then count also `.' and `..'. Also abbreviate `mode-name', using "Dired/" instead of "Dired by". -- ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Dired - ls-switches on Modeline 2020-05-13 15:27 ` Drew Adams @ 2020-05-13 16:01 ` arthur miller 2020-05-14 1:31 ` Arthur Miller 1 sibling, 0 replies; 5+ messages in thread From: arthur miller @ 2020-05-13 16:01 UTC (permalink / raw) To: Drew Adams, emacs-devel@gnu.org [-- Attachment #1: Type: text/plain, Size: 1589 bytes --] Sure, not at home now, but can do later in the evening. Regards /a Skickat från min Samsung Galaxy-smartphone. -------- Originalmeddelande -------- Från: Drew Adams <drew.adams@oracle.com> Datum: 2020-05-13 17:28 (GMT+01:00) Till: Arthur Miller <arthur.miller@live.com>, emacs-devel@gnu.org Ämne: RE: Dired - ls-switches on Modeline > I suggest as a usability improvement to add a user option to > enable/disable display of ls-switches on modeline Sounds good to me. E.g. A user option whose value is a format string that accepts the value of `dired-actual-switches' and returns the text to use in the mode-line. Trivial to do. You might want to file an enhancement request for this (`M-x report-emacs-bug'). ___ If the request doesn't get accepted for some reason then perhaps I'll do it for Dired+.el. I already add additional info to the mode-line (on a hook, so you can remove it): -- Show number of marked, flagged, and current-list lines in mode-line. (Flagged means flagged for deletion.) If the current line is marked/flagged and there are others marked/flagged after it then show `N/M', where `N' is the number marked/flagged through the current line and `M' is the total number marked/flagged. If the current line is for a file then show `L/T', where `L' is the line number in the current listing and `T' is the number of files in that listing. If option `diredp-count-.-and-..-flag' is non-nil then count also `.' and `..'. Also abbreviate `mode-name', using "Dired/" instead of "Dired by". -- [-- Attachment #2: Type: text/html, Size: 2714 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Dired - ls-switches on Modeline 2020-05-13 15:27 ` Drew Adams 2020-05-13 16:01 ` arthur miller @ 2020-05-14 1:31 ` Arthur Miller 2020-05-14 15:29 ` Drew Adams 1 sibling, 1 reply; 5+ messages in thread From: Arthur Miller @ 2020-05-14 1:31 UTC (permalink / raw) To: Drew Adams; +Cc: emacs-devel Drew Adams <drew.adams@oracle.com> writes: >> I suggest as a usability improvement to add a user option to >> enable/disable display of ls-switches on modeline > > Sounds good to me. > > E.g. A user option whose value is a format string > that accepts the value of `dired-actual-switches' > and returns the text to use in the mode-line. > Trivial to do. > > You might want to file an enhancement request for > this (`M-x report-emacs-bug'). > ___ > > If the request doesn't get accepted for some reason > then perhaps I'll do it for Dired+.el. > > I already add additional info to the mode-line (on > a hook, so you can remove it): > > -- > > Show number of marked, flagged, and current-list lines in mode-line. > (Flagged means flagged for deletion.) > If the current line is marked/flagged and there are others > marked/flagged after it then show `N/M', where `N' is the number > marked/flagged through the current line and `M' is the total number > marked/flagged. > > If the current line is for a file then show `L/T', where `L' is the > line number in the current listing and `T' is the number of files in > that listing. If option `diredp-count-.-and-..-flag' is non-nil then > count also `.' and `..'. > > Also abbreviate `mode-name', using "Dired/" instead of "Dired by". > > -- That seems a lot of stuff Drew :-). I don't really get you, did you already implemented all that in Dired+ or do you wish to implement all that? I do have your Dired+ but honestly, it is a little big, so I never got really time to get into it, so I don't really know what it offers. Anyway I just need a simple way to remove ls-switches from modeline. I don't find it usefull at all to see switches on modeline, I don't understand why it is on by default. I guess somebody found it useful :-). I don't really need formated ls-switches on modeline, for me, it is a bit overkill. I just wish to turn it off, and in some rare case if I would ever need to see my switches, so I can turn them on. I will file a bug repport and send a patch to offer defcustom user option to turn that off/on, but you would probably like to make it more customizable as you suggest for Dired+? Thanks for all your work and best regards. ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Dired - ls-switches on Modeline 2020-05-14 1:31 ` Arthur Miller @ 2020-05-14 15:29 ` Drew Adams 0 siblings, 0 replies; 5+ messages in thread From: Drew Adams @ 2020-05-14 15:29 UTC (permalink / raw) To: Arthur Miller; +Cc: emacs-devel > > Sounds good to me. > > > > E.g. A user option whose value is a format string > > that accepts the value of `dired-actual-switches' > > and returns the text to use in the mode-line. > > Trivial to do. > > > > You might want to file an enhancement request for > > this (`M-x report-emacs-bug'). > > ___ > > > > If the request doesn't get accepted for some reason > > then perhaps I'll do it for Dired+.el. > > > > I already add additional info to the mode-line (on > > a hook, so you can remove it): > > > > -- > > > > Show number of marked, flagged, and current-list lines in mode-line. > > (Flagged means flagged for deletion.) > > If the current line is marked/flagged and there are others > > marked/flagged after it then show `N/M', where `N' is the number > > marked/flagged through the current line and `M' is the total number > > marked/flagged. > > > > If the current line is for a file then show `L/T', where `L' is the > > line number in the current listing and `T' is the number of files in > > that listing. If option `diredp-count-.-and-..-flag' is non-nil then > > count also `.' and `..'. > > > > Also abbreviate `mode-name', using "Dired/" instead of "Dired by". > > > > -- > That seems a lot of stuff Drew :-). I don't really get you, did you > already implemented all that in Dired+ or do you wish to implement all > that? What I described as "I already add" is in the mode line (with Dired+). What you suggested, and the related formatting user option I suggested for that, is not (yet) in Dired+. I won't add that to Dired+ if you can get it in vanilla Emacs. If not, maybe I will. > I do have your Dired+ but honestly, it is a little big, so I never got > really time to get into it, so I don't really know what it offers. Most of what it offers is available from the menu-bar menus, to make it discoverable etc. > Anyway I just need a simple way to remove ls-switches from modeline. I > don't find it usefull at all to see switches on modeline, I don't > understand why it is on by default. I guess somebody found it useful > :-). I don't really need formated ls-switches on modeline, for me, it > is a bit overkill. I just wish to turn it off, and in some rare case if I > would ever need to see my switches, so I can turn them on. To be clear, the switches are only shown when they differ from the simple sort-by-name and sort-by-date behavior. But yes, being able to control what's shown in the mode-line is always a good idea. This is something that kind of applies to Emacs generally. Related: it's not so easy for a user to modify/customize the mode-line. > I will file a bug repport and send a patch to offer defcustom user > option to turn that off/on, but you would probably like to make it more > customizable as you suggest for Dired+? I suggested that the option (for vanilla Dired) that you propose could optionally have, as its value, a formatting string, to give users more control than simply on/off. But if that doesn't happen for vanilla Dired then I might do it for Dired+. The aim of Dired+ is just to supplement Dired. Dired+ essentially amounts to behavior/stuff that I've proposed for vanilla Dired but that wasn't adopted, for whatever reasons. (About the only thing that was adopted is highlighting `w' in the permissions for group and world. And that happens only if you customize face `dired-perm-write' to something other than `default'.) IOW, if such behavior is in vanilla Dired then so much the better - no need for me to put it in Dired+ and have to maintain it. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-05-14 15:29 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-05-13 9:10 Dired - ls-switches on Modeline Arthur Miller 2020-05-13 15:27 ` Drew Adams 2020-05-13 16:01 ` arthur miller 2020-05-14 1:31 ` Arthur Miller 2020-05-14 15:29 ` Drew Adams
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.