[EMMS] Add custom tree traversal function

Based on the default one using GNU find.
This commit is contained in:
Daniel - 2017-08-06 11:46:55 +02:00
parent 97e0e93336
commit 8f539afa91
Signed by: dbo
GPG Key ID: 4F63DB96D45AA9C6
1 changed files with 23 additions and 0 deletions

23
init.el
View File

@ -905,6 +905,29 @@ _h_ _l_ _o_k _y_ank
(setq emms-source-file-default-directory "~/Documents/media/audio/")
(defun db/emms-source-file-directory-tree-find (dir regex)
"Return a list of all files under DIR that match REGEX.
This function uses the external find utility. The name for GNU find
may be supplied using `emms-source-file-gnu-find'.
Difference to original `emms-source-file-directory-tree-find is
that we also follow symbolic links."
(with-temp-buffer
(call-process emms-source-file-gnu-find
nil t nil
"-L"
(expand-file-name dir)
"-type" "f"
"-iregex" (concat ".*\\(" regex "\\).*"))
(delete ""
(split-string (buffer-substring (point-min)
(point-max))
"\n"))))
(unless (memq system-type '(windows-nt ms-dos))
(setq emms-source-file-directory-tree-function
#'db/emms-source-file-directory-tree-find))
(defadvice emms-tag-editor-submit (after delete-window activate)
(delete-window))