Morning EMMS users !
I finally found a way to update the playlist after a shuffle.
Jorgen, if you agree with it, I'll install it.
(defun emms-playlist-search-track (track)
"Returns the index of the track TRACK."
(catch 'loop
(let ((i 0)
(track-fullpath (cdr (assoc 'name track))))
(while (< i (length emms-playlist))
(let ((i-fullpath (cdr (assoc 'name (elt emms-playlist i)))))
(if (string= track-fullpath i-fullpath)
(throw 'loop i)
(setq i (1+ i))))))))
(defun emms-playlist-shuffle ()
"Shuffle the current playlist."
(let ((current-track (emms-playlist-current-track)))
(emms-playlist-set-playlist
(emms-playlist-shuffle-vector
(emms-playlist-get-playlist)))
;; loop to find the "lost" track.
(let ((new-index (emms-playlist-search-track current-track)))
(emms-playlist-set-current new-index)
(emms-pbi-rebuild-playlist-buffer))))
--
Lucas, less tired this morning than yesterday evening :)
_______________________________________________
Emms-help mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/emms-help