branch: externals/emms commit e5f46561c3c140d774354f91d1e95c60039a1934 Author: Yoni Rabkin <y...@gnu.org> Commit: Yoni Rabkin <y...@gnu.org>
* emms.el: add `insert-current' to `define-emms-source' macro `insert-current' will add the source after the current track. --- emms.el | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/emms.el b/emms.el index 0b9b061faf..910ffe7487 100644 --- a/emms.el +++ b/emms.el @@ -1468,6 +1468,7 @@ See emms-source-file.el for some examples." (source-play (intern (format "emms-play-%s" name))) (source-add (intern (format "emms-add-%s" name))) (source-insert (intern (format "emms-insert-%s" name))) + (source-insert-current (intern (format "emms-insert-current-%s" name))) (docstring "A source of tracks for EMMS.") (interactive nil) (call-args (delete '&rest @@ -1500,7 +1501,11 @@ See emms-source-file.el for some examples." (defun ,source-insert ,arglist ,docstring ,interactive - (emms-source-insert ',source-name ,@call-args))))) + (emms-source-insert ',source-name ,@call-args)) + (defun ,source-insert-current ,arglist + ,docstring + ,interactive + (emms-source-insert-current ',source-name ,@call-args))))) (defun emms-source-play (source &rest args) "Play the tracks of SOURCE, after first clearing the EMMS playlist." @@ -1525,6 +1530,15 @@ See emms-source-file.el for some examples." (with-current-emms-playlist (apply #'emms-playlist-insert-source source args))) +(defun emms-source-insert-current (source &rest args) + "Insert from SOURCE into buffer at current track." + (with-current-emms-playlist + (if (not emms-playlist-selected-marker) + (error "no current playlist track") + (goto-char emms-playlist-selected-marker) + (forward-line)) + (apply #'emms-playlist-insert-source source args))) + ;;; User-defined playlists ;;; FIXME: Shuffle is bogus here! (because of narrowing) (defmacro define-emms-combined-source (name shufflep sources)