From 84976d82cfda6fac3af21b1e1b0df81c2136c80b Mon Sep 17 00:00:00 2001 From: William Xu Date: Wed, 16 Apr 2008 16:05:00 +0000 Subject: (emms-sort-natural-order-less-p): Handle empty 'info-album(treat as "" when sorting) correctly. darcs-hash:20080416160530-cfa61-de44c3dd75d0a5a75111ea1c544e457408bed594.gz --- emms-playlist-sort.el | 18 ++++++++++-------- 1 file 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 -- cgit v1.2.3