Show files by date in SOME Emacs dired buffer

  |   Source

It's as simple as modify dired-actual-switches in dired-mode-hook.

Minimum setup,

(defvar my-dired-new-file-first-dirs
  '("bt/finished/$"
    "bt/torrents?/$"
    "documents?/$"
    "music/$"
    "downloads?/$")
  "Dired directory patterns where newest files are on the top.")

(defun my-dired-mode-hook-setup ()
  "Set up Dired."
  (when (cl-find-if (lambda (regexp)
                      (let ((case-fold-search t))
                        (string-match regexp default-directory)))
                my-dired-new-file-first-dirs)
    (setq dired-actual-switches "-lat")))
(add-hook 'dired-mode-hook 'my-dired-mode-hook-setup)

Here is my real world setup.

Comments powered by Disqus