aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorYoni Rabkin <yoni@rabkins.net>2018-07-08 21:23:54 -0400
committerYoni Rabkin <yoni@rabkins.net>2018-07-08 21:23:54 -0400
commit9b702f38e3486d67cb67194e98ea72dda25be1af (patch)
tree6c8406d0d84f1686e6ecf37c7209f9977699aa26 /lisp
parent4cc4dd97c40f4275f1e4aba0ac5964feb1a7e278 (diff)
* lisp/emms.el: add `emms-ok-track-function'
Add `emms-ok-track-function', which is a simpler way of controlling if Emms would skip a particular track.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/emms.el14
1 files changed, 13 insertions, 1 deletions
diff --git a/lisp/emms.el b/lisp/emms.el
index 8bb9ffb..9014924 100644
--- a/lisp/emms.el
+++ b/lisp/emms.el
@@ -177,6 +177,11 @@ shouldn't assume that the track has been inserted before."
:type 'function)
(make-variable-buffer-local 'emms-playlist-delete-track-function)
+(defcustom emms-ok-track-function 'emms-default-ok-track-function
+ "*Function returns true if we shouldn't skip this track."
+ :group 'emms
+ :type 'function)
+
(defcustom emms-playlist-source-inserted-hook nil
"*Hook run when a source got inserted into the playlist.
The buffer is narrowed to the new tracks."
@@ -414,7 +419,10 @@ This is a good function to put in `emms-player-next-function'."
(emms-playlist-current-select-next)
t)
(error nil))
- (emms-start))
+ (if (funcall emms-ok-track-function
+ (emms-playlist-current-selected-track))
+ (emms-start)
+ (emms-next-noerror)))
(t
(message "No next track in playlist"))))
@@ -1249,6 +1257,10 @@ ignore this."
(emms-playlist-select pos)
(emms-playlist-first)))))
+(defun emms-default-ok-track-function (track)
+ "A function which OKs all tracks for playing by default."
+ t)
+
;;; Helper functions
(defun emms-property-region (pos prop)
"Return a pair of the beginning and end of the property PROP at POS.