How do I make Dired display its files using an arbitrary function or set of columns? Basically I want to change from:
-rw-r--r-- 1 konrad konrad 3847863 Out 18 14:17 ClojureinAction.pdf
-rw-rw-r-- 1 tamara tamara 27338341 Out 20 07:16 Halliday, Resnick, Walker - Fundamentals of Physics.pdf
-rw-r--r-- 1 konrad konrad 3921024 Set 22 11:11 Pragmatic.Programming.Clojure.May.2009.pdf
To something like
644 1-5MB ClojureinAction.pdf PDF (5 days ago, 400pgs)
664 10-100MB Halliday, Resnic...pdf PDF (3 days ago, 1000pgs, Tamara's)
644 1-5MB Pragmatic.Progra...pdf PDF (1 min ago, 100 pages)
Thanks!
EDIT: Thanks for the answer, Gareth, but could you be more verbose, please? Apparently the hook will just allow me to run arbitrary code when the buffer loads up. Dired won't even stop loading up the buffer :(
(defun foo (&rest args) (unlocking-buffer (message "foo") (insert "foo\n")))
Glancing at dired's source code, it seems that it gets information from these very formats I'm trying to replace, so I wonder if it's viable to change it this way, or if I'll end up having to rewrite everything.
Dired mode makes quite a few assumptions about ls
output format, so changing the format will break many things. I think a more feasible approach is to leave the format alone, and use either text-properties or overlays to change the presentation.