Path: utzoo!attcan!uunet!wuarchive!brutus.cs.uiuc.edu!apple!oliveb!amdahl!daveemme From: daveemme@uts.amdahl.com (Dave Emme) Newsgroups: comp.emacs Subject: Re: dired sorting by date Message-ID: <572C02cp4emH01@amdahl.uts.amdahl.com> Date: 25 Aug 89 00:12:25 GMT References: <44719@bbn.COM> Reply-To: daveemme@amdahl.uts.amdahl.com (Dave Emme) Organization: Amdahl Corporation, Sunnyvale CA Lines: 39 In article <44719@bbn.COM> sboisen@bbn.com writes: > [...] >any suggestions for how to sort a dired buffer by _date_? > [...] Well, I use the following, which can be placed in your ".emacs" file. It's sort of a hack, but it works. The "s" key in the dired keymap is defined to call "dired-sort", which toggles the arguments to ls(1) between their normal dired value and a set which sorts by date. Each time you press the "s" key the arguments are toggled, ls(1) is called, and the results displayed. The ls(1) arguments are local to each dired buffer. Enjoy! -------------------- Cut Here -------------------- (load "dired") (make-variable-buffer-local 'dired-listing-switches) (setq-default dired-listing-switches "-als") (define-key dired-mode-map "s" 'dired-sort) (defun dired-sort () "Alternates dired listing order between sorted-by-name and sorted-by-date." (interactive) (setq dired-listing-switches (if (string-equal dired-listing-switches "-als") "-alts" "-als")) (revert-buffer)) -- ------------------------------------------------------------------------------ Dave Emme daveemme@uts.amdahl.com Amdahl Corporation {ames, decwrl, sun, uunet}!amdahl!daveemme 1250 E. Arques Ave. M/S 316 Sunnyvale, CA. 94088-3470 "Whenever you find yourself on the side of the majority, it is time to pause and reflect." -- Mark Twain