aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaimrod <daimrod@gmail.com>2013-05-10 19:49:58 +0200
committerLucas Bonnet <lbonnet@bearstech.com>2013-05-15 11:44:53 +0200
commita8563e6d3f80c26434e61752e2e43420bfcdd81b (patch)
tree4469765b08b0ccfd8500aaee0f6bd40146337340
parent82e8bdd7a748921eb3ac4723d9c176391db9ccd5 (diff)
Play tracks randomly
[[PGP Signed Part:No public key for 137354772B651894 created at 2013-05-10T19:49:58+0200 using RSA]] Yoni Rabkin <yoni@rabkins.net> writes: > Daimrod <daimrod@gmail.com> writes: > >> Yoni Rabkin <yoni@rabkins.net> writes: >> >>> Daimrod <daimrod@gmail.com> writes: >>> >>>> Hello, >>>> >>>> I've attached a small patch which adds `emms-toggle-random-playlist'. It >>>> sets `emms-player-next-function' to either `emms-next-noerror' or >>>> `emms-random'. >>> >>> How is this different from running M-x emms-shuffle on the playlist? >> >> I agree they're close, but this one doesn't shuffle the playlist and it >> persists when the playlist is changed. > > I certainly have no problem with it; I was just making sure you were > aware of emms-shuffle. > > If Lucas is fine with installing it (I don't think it needs assignment > papers) I would ask that you please also send in a patch to the manual > documenting this change. I have already made a copyright assignment for Emacs and I have no problem to do it for EMMS if it is required. I've attached the patch with the documentation. [2. text/x-diff; 0001-New-command-to-play-the-tracks-randomly.patch] From b03cb56436a598a953fa49b456a88630f319b644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= <gregoire.jadi@gmail.com> Date: Fri, 10 May 2013 19:44:59 +0200 Subject: [PATCH] New command to play the tracks randomly * lisp/emms.el (emms-random-playlist): An option to determine whether the tracks are played randomly or sequentially. (emms-toggle-random-playlist): Trigger the previous option and set `emms-play-next-function' accordingly. * doc/emms.texinfo(Core Functions): Document`emms-toggle-random-playlist'.
-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'."