diff options
-rw-r--r-- | bongo.el | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -1030,3 +1030,39 @@ TIME must be a list of two to four elements." ;;; Bonmark (use-package "bonmark" 'bonmark) + +;;; search and insert + +(defun durand-bongo-search-insert () + "Search a song and insert it in the playlist buffer." + (interactive) + (let* ((songs + (mapcar + (lambda (file) + (cons + (file-name-nondirectory file) + (file-name-directory file))) + (flatten-tree + (mapcar + (lambda (dir) + (directory-files-recursively + dir + (rx-to-string + '(seq "." (or "mp3" "mkv" "webm" "m4a") eos) + t) + nil nil t)) + durand-bongo-music-dir)))) + (choice + (completing-read + "Search and insert: " songs + nil t)) + (choice + (assoc choice songs #'equal)) + (choice + (expand-file-name + (car choice) + (cdr choice)))) + (bongo-insert-file choice))) + +(define-key bongo-playlist-mode-map (vector ?/) + #'durand-bongo-search-insert) |