aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorFran Burstall <fran.burstall@gmail.com>2018-10-17 21:02:50 +0100
committerFran Burstall <fran.burstall@gmail.com>2018-10-17 21:02:50 +0100
commitc31006f83af6b3bb87f444581ddde38b331199da (patch)
treeba4c9ba7f3f1a786ff2689ba72f108ad0881dae9 /lisp
parent955b15cef78872b55625b0fc32798c569ec7615b (diff)
* lisp/emms-playlist-sort.el: sort current buffer
Sort the playlist in the current buffer rather than emms-current-playlist
Diffstat (limited to 'lisp')
-rw-r--r--lisp/emms-playlist-sort.el16
1 files changed, 7 insertions, 9 deletions
diff --git a/lisp/emms-playlist-sort.el b/lisp/emms-playlist-sort.el
index d9fc519..e23604b 100644
--- a/lisp/emms-playlist-sort.el
+++ b/lisp/emms-playlist-sort.el
@@ -1,6 +1,6 @@
;;; emms-playlist-sort.el --- sort emms playlist
-;; Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2018 Free Software Foundation, Inc.
;; Author: William Xu <william.xwl@gmail.com>
@@ -165,7 +165,7 @@ With a prefix argument, oldest first."
(defun emms-playlist-sort (predicate)
"Sort the playlist buffer by PREDICATE."
- (with-current-emms-playlist
+ (emms-with-inhibit-read-only-t
(emms-playlist-ensure-playlist-buffer)
(let ((current (emms-playlist-selected-track))
(tracks (nreverse
@@ -174,14 +174,12 @@ With a prefix argument, oldest first."
(delete-region (point-min) (point-max))
(run-hooks 'emms-playlist-cleared-hook)
(mapc 'emms-playlist-insert-track (sort tracks predicate))
- (let ((pos (text-property-any
- (point-min) (point-max) 'emms-track current)))
- (if pos
+ (let ((pos (when current (text-property-any (point-min) (point-max)
+ 'emms-track current))))
+ (if pos
(emms-playlist-select pos)
- (emms-playlist-first))
- ;; (emms-playlist-mode-center-current)
- (goto-char (point-min))
- ))))
+ (emms-playlist-first)))
+ (goto-char (point-min)))))
(defun emms-sort-natural-order-less-p (a b)
"Sort two tracks by natural order.