Path: utzoo!utgpu!watmath!att!dptg!rutgers!apple!bbn!gateway!dsys.ncsl.nist.GOV!rbj From: rbj@dsys.ncsl.nist.GOV (Root Boy Jim) Newsgroups: comp.emacs Subject: dired sorting by date Message-ID: <8908301637.AA26322@dsys.ncsl.nist.gov> Date: 30 Aug 89 16:37:55 GMT Sender: news@bbn.COM Organization: National Institute of Standards and Technology formerly National Bureau of Standards Lines: 41 ? From: Denys Duchier ? In article <123916@sun.Eng.Sun.COM>, rock%warp (Bill Petro) writes: ? > Even better, any suggestions for how to sort a dired buffer by _size_ ? ? The following works on my machine: Hmmmm. This seems to sort on the userid. Perhaps you have a weird ls? And you have to use it all the time. It should be a separate function. Not to be outdone, here is my version, simpler and more general: Add the following to your .emacs to sort by both time and date: (setq dired-mode-hook 'dired-mode-hook) (defun dired-mode-hook () "Define dired extensions" (setq case-fold-search t) ; Why is this not done? (define-key dired-mode-map "t" 'dired-sort-by-time) (define-key dired-mode-map "s" 'dired-sort-by-size) (setq dired-mode-hook nil)) (defun dired-sort-by-time (arg) ; t "Reread directory and sort by time. Reverse sort with prefix." (interactive "P") (let ((dired-listing-switches (concat dired-listing-switches "t" (and arg "r")))) (revert-buffer))) (defun dired-sort-by-size (arg) ; s "Reread directory and sort by size. Reverse sort with prefix." (interactive "P") (revert-buffer) (shell-command-on-region (point-min) (point-max) (concat "sort +3n" (and arg " -r")) t)) ? --Denys Root Boy Jim and the GNU Bohemians