From 8f539afa9115d2a1d687b917eb0a09d831ae69f9 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 6 Aug 2017 11:46:55 +0200 Subject: [PATCH] [EMMS] Add custom tree traversal function Based on the default one using GNU find. --- init.el | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/init.el b/init.el index 1027cf9..e211af9 100644 --- a/init.el +++ b/init.el @@ -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))