aboutsummaryrefslogtreecommitdiff
path: root/emms.el
diff options
context:
space:
mode:
authorforcer <forcer>2005-09-13 02:06:00 +0000
committerforcer <mwolson@gnu.org>2005-09-13 02:06:00 +0000
commit2eb4f321a46888dad9fb35996e5d081db1a71517 (patch)
treee639b084278324e653e6160af1c66b9645e371d5 /emms.el
parentb4c652a8f64b5d1426c47ea216f37ad6ad1861f1 (diff)
Keep the selected song correct for shuffling and sorting
darcs-hash:20050913020638-2189f-293bdbd2dd6e836d9348adac36e4f67b2a5c751b.gz
Diffstat (limited to 'emms.el')
-rw-r--r--emms.el27
1 files changed, 23 insertions, 4 deletions
diff --git a/emms.el b/emms.el
index f19756e..60595e7 100644
--- a/emms.el
+++ b/emms.el
@@ -307,8 +307,19 @@ This uses `emms-shuffle-function'."
This is a suitable value for `emms-shuffle-function'."
(interactive)
(with-current-emms-playlist
- (emms-playlist-shuffle (point-min)
- (point-max))))
+ (let ((current nil))
+ (when emms-player-playing-p
+ (setq current (emms-playlist-selected-track))
+ (goto-char emms-playlist-selected-marker)
+ (emms-playlist-kill-track))
+ (emms-playlist-shuffle (point-min)
+ (point-max))
+ (if emms-player-playing-p
+ (progn
+ (goto-char (point-min))
+ (emms-playlist-insert-track current))
+ (emms-playlist-first)))
+ (goto-char (point-max))))
(defun emms-sort ()
"Sort the current playlist.
@@ -321,8 +332,16 @@ This uses `emms-shuffle-function'."
This is a suitable value for `emms-sort-function'."
(interactive)
(with-current-emms-playlist
- (emms-playlist-sort (point-min)
- (point-max))))
+ (let ((current (emms-playlist-selected-track)))
+ (emms-playlist-sort (point-min)
+ (point-max))
+ (let ((pos (text-property-any (point-min)
+ (point-max)
+ 'emms-track current)))
+ (if pos
+ (emms-playlist-select pos)
+ (emms-playlist-first))))
+ (goto-char (point-max))))
(defun emms-toggle-repeat-playlist ()
"Toggle whether emms repeats the playlist after it is done.