1

At my new job I'm using Emacs 24 on Windows, and its chief use for me in these particular circumstances is as a file manager.

I'd like to jettison everything from the Dired display except filename, size, and date. This question showed me how to use ls-lisp-verbosity to remove most of the detail that I don't want.

But I haven't found a way to keep from displaying the permissions. I've checked the documentation for ls and for dir, and there doesn't seem to be a flag for "don't show permissions". And so far I haven't found anything in Dired that will omit the permissions. Can this be done?

Community
  • 1
  • 1
user11583
  • 431
  • 3
  • 11
  • Hmmm. I'm at home Sat. morning and I've installed DiredDetails on my Linux machine. It toggles between the conventional Dired display, and showing only the filename. I'm now reading through the DiredDetails code to see if I can customize it to show the filesize and date. Or maybe I can combine DD and ls-lisp-verbosity to get what I want. Then, make sure it works identically on Windows. – user11583 Aug 11 '12 at 13:09
  • Modifying DiredDetails to show filesize and date, as well as the filename, requires more ability with elisp than I currently have. Can anyone help, or suggest an alternative solution? – user11583 Aug 12 '12 at 19:59
  • Using GNU ls program which has —dired option, and let GNU ls on the PATH. see https://github.com/junjiemars/.emacs.d/blob/master/config/on-dired-autoload.el – 南山竹 Jul 24 '18 at 02:48
  • @南山竹 there's no GNU ls option that displays the date but not the permissions. One possibility is to write a shell/perl/etc. script that invokes ls and then filters out the permissions. – Jim Balter Nov 02 '18 at 04:23

1 Answers1

1

Your best option is to change the ls switches so that Dired does not list those fields. See M-x man ls for your particular platform, to see what ls switches are available to you.

dired-details.el (and dired-details+.el) are no longer needed if you have Emacs 24.4 (or a pre-release development snapshot). Just use ( to toggle between showing and hiding details.

And in that case you at least have two options to control whether symbolic-link targets or all lines except header and file lines are considered details to hide: dired-hide-details-hide-symlink-targets and dired-hide-details-hide-information-lines.

If changing ls switches does not help in your case, then you would need to tweak function dired-details-make-current-line-overlay from dired-details.el. The details to be hidden are determined by the first cond clause, which is this (wrapped in ignore-errors):

(dired-move-to-filename t)

That moves point to the beginning of the file name. The next line is this:

 (make-overlay (+ 2 bol) (point))

That creates the invisibility overlay from the beginning of the line (bol here) up to the beginning of the file name (point).

If you want something different then you need to get the limits that you want for the overlay. For example, if you want invisibility to start at the file size, then you would search forward with a regexp that finds the beginning of the file size.

You can come up with such a regexp by working from the regexp for dired-move-to-filename-regexp (in library dired.el). It is a very complex regexp that matches everything up to the file name. But you can use it to find the date+time portion, which is either the 7th matching regexp subgroup or the 2nd, depending on whether the date+time is expressed using a locale (western or eastern) or using ISO representation.

You can see how this is handled in the code defining variable diredp-font-lock-keywords-1 of library dired+.el.

But again, the best approach, if it does what you want, is to try to use ls switches to control which fields are listed in the first place. You can easily experiment with switches by using a prefix argument with C-x d - you are prompted for the switches to use.

Drew
  • 29,895
  • 7
  • 74
  • 104
  • There's no ls switch that displays the date but not the permissions. One possibility is to write a shell/perl/etc. script that invokes ls and then filters out the permissions. – Jim Balter Nov 02 '18 at 04:21