aboutsummaryrefslogtreecommitdiff
path: root/emms-playlist-sort.el
diff options
context:
space:
mode:
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)