aboutsummaryrefslogtreecommitdiff
path: root/emms-playlist-sort.el
diff options
context:
space:
mode:
authorWilliam Xu <william.xwl@gmail.com>2007-07-05 16:02:00 +0000
committerWilliam Xu <william.xwl@gmail.com>2007-07-05 16:02:00 +0000
commit3b6c9a35fafca4eaa9ad5896ffae782ed2348e10 (patch)
tree369efe1cb625e0d283db39a46bc2442eee45b81f /emms-playlist-sort.el
parent2662277d79bd1ac1f4b376f0f1486c8731017931 (diff)
New file: emms-playlist-limit.el. And minor updates to emms-playlist-sort.
darcs-hash:20070705160221-cfa61-c16a2727863237aa851657d35705cd8cbfed3145.gz
Diffstat (limited to 'emms-playlist-sort.el')
-rw-r--r--emms-playlist-sort.el37
1 files changed, 18 insertions, 19 deletions
diff --git a/emms-playlist-sort.el b/emms-playlist-sort.el
index 0600b0a..0af3fb3 100644
--- a/emms-playlist-sort.el
+++ b/emms-playlist-sort.el
@@ -124,25 +124,24 @@ increasingly."
(defun emms-playlist-sort (predicate &optional start end)
"Sort the playlist buffer by PREDICATE.
If START and END are not provided, the whole buffer will be sorted."
- (let ((run-cleared-hook nil))
- (unless start (setq start (point-min)))
- (unless end (setq end (point-max)))
- (with-current-emms-playlist
- (save-excursion
- (emms-playlist-ensure-playlist-buffer)
- (widen)
- (let ((current (emms-playlist-selected-track))
- (tracks
- (emms-playlist-tracks-in-region start end)))
- (delete-region start end)
- (run-hooks 'emms-playlist-cleared-hook)
- (mapc 'emms-playlist-insert-track
- (sort tracks predicate))
- (let ((pos (text-property-any start end
- 'emms-track current)))
- (if pos
- (emms-playlist-select pos)
- (emms-playlist-first))))))))
+ (unless start (setq start (point-min)))
+ (unless end (setq end (point-max)))
+ (with-current-emms-playlist
+ (save-excursion
+ (emms-playlist-ensure-playlist-buffer)
+ (widen)
+ (let ((current (emms-playlist-selected-track))
+ (tracks
+ (emms-playlist-tracks-in-region start end)))
+ (delete-region start end)
+ (run-hooks 'emms-playlist-cleared-hook)
+ (mapc 'emms-playlist-insert-track
+ (sort tracks predicate))
+ (let ((pos (text-property-any start end
+ 'emms-track current)))
+ (if pos
+ (emms-playlist-select pos)
+ (emms-playlist-first)))))))
(defun emms-string> (a b)
(not (or (emms-string< a b)