From 9b702f38e3486d67cb67194e98ea72dda25be1af Mon Sep 17 00:00:00 2001 From: Yoni Rabkin Date: Sun, 8 Jul 2018 21:23:54 -0400 Subject: * 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. --- lisp/emms.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'lisp') 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. -- cgit v1.2.3