Helm: Add "Add to EMMS playlist" find-file action

master
Pierre Neidhardt 2019-04-13 10:45:15 +02:00
parent 260f1421a3
commit 3a734df3cc
1 changed files with 13 additions and 0 deletions

View File

@ -310,6 +310,19 @@ With prefix argument, UPDATE the databases with custom uptions thanks to the
(and (not (string-match-p ffap-url-regexp candidate))
helm-ff-default-directory
(locate-dominating-file helm-ff-default-directory ".git")))
1)
(helm-source-add-action-to-source-if
"Add to EMMS playlist"
(lambda (_candidate)
(when (require 'emms nil 'noerror)
(dolist (c (helm-marked-candidates))
(emms-add-directory-tree c))))
source
(lambda (candidate)
(or (file-directory-p candidate)
(and (file-name-extension candidate)
(string-match-p (concat (regexp-opt '("mp3" "mp4" "m4a" "ogg" "flac" "spx" "wma" "wv")) "$")
(file-name-extension candidate)))))
1))
(provide 'init-helm)