diff options
author | William Xu <william.xwl@gmail.com> | 2008-04-16 16:05:00 +0000 |
---|---|---|
committer | William Xu <william.xwl@gmail.com> | 2008-04-16 16:05:00 +0000 |
commit | 84976d82cfda6fac3af21b1e1b0df81c2136c80b (patch) | |
tree | d744c4c7294b486183771c3c52388c8e8fe50eaf | |
parent | bc41b9789b270cad9376e961fd6195d3e31fa9b5 (diff) |
(emms-sort-natural-order-less-p): Handle empty 'info-album(treat as ""
when sorting) correctly.
darcs-hash:20080416160530-cfa61-de44c3dd75d0a5a75111ea1c544e457408bed594.gz
-rw-r--r-- | emms-playlist-sort.el | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/emms-playlist-sort.el b/emms-playlist-sort.el index f18aa99..3916c74 100644 --- a/emms-playlist-sort.el +++ b/emms-playlist-sort.el @@ -163,14 +163,16 @@ With a prefix argument, decreasingly." "Sort two tracks by natural order. This is the order in which albums where intended to be played. ie. by album name and then by track number." - (or (emms-string> (emms-track-get a 'info-album) - (emms-track-get b 'info-album)) - (and (string= (emms-track-get a 'info-album) - (emms-track-get b 'info-album)) - (< (string-to-number (or (emms-track-get a 'info-tracknumber) - "0")) - (string-to-number (or (emms-track-get b 'info-tracknumber) - "0")))))) + (let ((album-a (emms-track-get a 'info-album)) + (album-b (emms-track-get b 'info-album))) + (or (emms-string< album-a album-b) + (and album-a + album-b + (string= album-a album-b) + (< (string-to-number (or (emms-track-get a 'info-tracknumber) + "0")) + (string-to-number (or (emms-track-get b 'info-tracknumber) + "0"))))))) (defun emms-playlist-sort-by-list-p (a b) (catch 'return |