diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/emms-playlist-sort.el | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lisp/emms-playlist-sort.el b/lisp/emms-playlist-sort.el index 0c3b466..d9fc519 100644 --- a/lisp/emms-playlist-sort.el +++ b/lisp/emms-playlist-sort.el @@ -118,6 +118,20 @@ With a prefix argument, decreasingly." (file-name-extension (emms-track-get a 'name)) (file-name-extension (emms-track-get b 'name)))))) +(defun emms-playlist-sort-by-file-mtime () + "Sort emms playlist by file mtime, newest first. +With a prefix argument, oldest first." + (interactive) + (emms-playlist-sort + '(lambda (a b) + (funcall + (if current-prefix-arg + 'time-less-p + (lambda (t1 t2) (not (time-less-p t1 t2)))) + (emms-info-track-file-mtime a) + (emms-info-track-file-mtime b))))) + + (defvar emms-playlist-sort-map nil) (defun emms-playlist-sort-map-setup () @@ -138,6 +152,7 @@ With a prefix argument, decreasingly." (define-key map (kbd "C") 'emms-playlist-sort-by-info-composer) (define-key map (kbd "L") 'emms-playlist-sort-by-list) (define-key map (kbd "N") 'emms-playlist-sort-by-name) + (define-key map (kbd "T") 'emms-playlist-sort-by-file-mtime) map)) (define-key emms-playlist-mode-map |