aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/emms.texinfo3
-rw-r--r--lisp/emms.el17
2 files changed, 20 insertions, 0 deletions
diff --git a/doc/emms.texinfo b/doc/emms.texinfo
index 3e271e2..692ec8a 100644
--- a/doc/emms.texinfo
+++ b/doc/emms.texinfo
@@ -670,6 +670,9 @@ Toggle whether emms repeats the playlist after it is done. See
Toggle whether emms repeats the current track. See
@var{emms-repeat-track}.
@end defun
+@defun emms-toggle-random-playlist
+Toggle whether emms plays the tracks randomly or sequentially. See
+@var{emms-random-playlist}.
Some functions deal with the getting and setting track information.
diff --git a/lisp/emms.el b/lisp/emms.el
index c9c4123..81bd80c 100644
--- a/lisp/emms.el
+++ b/lisp/emms.el
@@ -81,6 +81,12 @@ If non-nil, EMMS will wrap back to the first track when that happens."
:group 'emms
:type 'boolean)
+(defcustom emms-random-playlist nil
+ "*Non-nil means that tracks are played randomly. If nil, tracks
+are played sequentially."
+ :group 'emms
+ :type 'boolean)
+
(defcustom emms-repeat-track nil
"Non-nil, playback will repeat current track. If nil, EMMS will play
track by track normally."
@@ -487,6 +493,17 @@ This uses `emms-playlist-uniq-function'."
(save-excursion
(funcall emms-playlist-uniq-function))))
+(defun emms-toggle-random-playlist ()
+ "Toggle whether emms plays the tracks randomly or sequentially.
+See `emms-random-playlist'."
+ (interactive)
+ (setq emms-random-playlist (not emms-random-playlist))
+ (if emms-random-playlist
+ (progn (setq emms-player-next-function 'emms-random)
+ (message "Will play the tracks randomly."))
+ (setq emms-play-next-function 'emms-next-noerror)
+ (message "Will play the tracks sequentially.")))
+
(defun emms-toggle-repeat-playlist ()
"Toggle whether emms repeats the playlist after it is done.
See `emms-repeat-playlist'."