Skip to content

Instantly share code, notes, and snippets.

@masutaka
Created December 16, 2011 17:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masutaka/1487093 to your computer and use it in GitHub Desktop.
Save masutaka/1487093 to your computer and use it in GitHub Desktop.
dired-todays-face
(defface dired-todays-face '((t (:foreground "forest green"))) nil)
(defvar dired-todays-face 'dired-todays-face)
(defconst month-name-alist
'(("1" . "Jan") ("2" . "Feb") ("3" . "Mar") ("4" . "Apr")
("5" . "May") ("6" . "Jun") ("7" . "Jul") ("8" . "Aug")
("9" . "Sep") ("10" . "Oct") ("11" . "Nov") ("12" . "Dec")))
(defun dired-today-search (arg)
"Fontlock search function for dired."
(search-forward-regexp
(let ((month-name
(cdr (assoc (format-time-string "%b") month-name-alist))))
(if month-name
(format
(format-time-string
"\\(%Y-%m-%d\\|%b %e\\|%%s %e\\) [0-9]....") month-name)
(format-time-string
"\\(%Y-%m-%d\\|%b %e\\) [0-9]....")))
arg t))
(eval-after-load "dired"
'(font-lock-add-keywords
'dired-mode
(list '(dired-today-search . dired-todays-face))))
@masutaka
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment