Hello! I have a couple tiny patches that are hopefully all self explanatory. Let me know what you think.
Thanks, Morgan
>From 3ebb548f9941e7491fccf46b9fe2b7d8e65877da Mon Sep 17 00:00:00 2001 From: Morgan Smith <[email protected]> Date: Tue, 6 Sep 2022 17:22:22 -0400 Subject: [PATCH 1/3] * emms.el: Use defcustom :set for `emms-random-playlist' This allows users to customize `emms-random-playlist' in their initialization file. --- emms.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/emms.el b/emms.el index 398ee9d..37f574c 100644 --- a/emms.el +++ b/emms.el @@ -88,6 +88,11 @@ If non-nil, EMMS will wrap back to the first track when that happens." "*Non-nil means that tracks are played randomly. If nil, tracks are played sequentially." :group 'emms + :set (lambda (symbol value) + (set symbol value) + (if value + (setq emms-player-next-function #'emms-random) + (setq emms-player-next-function #'emms-next-noerror))) :type 'boolean) (defcustom emms-repeat-track nil @@ -579,11 +584,9 @@ This uses `emms-playlist-uniq-function'." "Toggle whether emms plays the tracks randomly or sequentially. See `emms-random-playlist'." (interactive) - (setq emms-random-playlist (not emms-random-playlist)) + (customize-set-variable 'emms-random-playlist (not emms-random-playlist)) (if emms-random-playlist - (progn (setq emms-player-next-function #'emms-random) - (message "Will play the tracks randomly.")) - (setq emms-player-next-function #'emms-next-noerror) + (message "Will play the tracks randomly.") (message "Will play the tracks sequentially."))) (defun emms-toggle-repeat-playlist () -- 2.41.0
>From b17f63fbb7a5d1d4441ae1f87eded33fe7b53d72 Mon Sep 17 00:00:00 2001 From: Morgan Smith <[email protected]> Date: Mon, 16 Oct 2023 21:55:24 -0400 Subject: [PATCH 2/3] * emms-source-file.el: Check if find is installed to pick directory tree function Set `emms-source-file-directory-tree-function' to `emms-source-file-directory-tree-find` when find is installed. --- emms-source-file.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/emms-source-file.el b/emms-source-file.el index 7186a92..5882906 100644 --- a/emms-source-file.el +++ b/emms-source-file.el @@ -56,8 +56,14 @@ "The default directory to look for media files." :type '(choice (const :tag "None" nil) file)) +(defcustom emms-source-file-gnu-find "find" + "The program name for GNU find." + :type 'string) + (defcustom emms-source-file-directory-tree-function - 'emms-source-file-directory-tree-internal + (if (executable-find emms-source-file-gnu-find) + 'emms-source-file-directory-tree-find + 'emms-source-file-directory-tree-internal) "*A function to call that searches in a given directory all files that match a given regex. DIR and REGEX are the only arguments passed to this function. @@ -80,10 +86,6 @@ You should set case-fold-search to nil before using this regexp in code." :type 'regexp) -(defcustom emms-source-file-gnu-find "find" - "The program name for GNU find." - :type 'string) - (defcustom emms-source-file-directory-hint-p t "When non-nil, guess the directory based on a track at point." :type 'boolean) -- 2.41.0
>From 913c28b22512451bc28a8e75a4e58ff33681c391 Mon Sep 17 00:00:00 2001 From: Morgan Smith <[email protected]> Date: Mon, 16 Oct 2023 21:57:27 -0400 Subject: [PATCH 3/3] * doc/emms.texinfo: Fix typo and document `emms-add-dired' `emms-source-dired' does not exist. Change it to `emms-play-dired'. --- doc/emms.texinfo | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/emms.texinfo b/doc/emms.texinfo index 65f5cca..852fd5e 100644 --- a/doc/emms.texinfo +++ b/doc/emms.texinfo @@ -871,9 +871,12 @@ An Emms source that will find files in @var{dir} or @defun emms-source-file-directory-tree &optional dir Return a list of all files under @var{dir} which match @var{regex}. @end defun -@defun emms-source-dired +@defun emms-play-dired Play all marked files of a dired buffer @end defun +@defun emms-add-dired +Add all marked files of a dired buffer +@end defun @defun emms-source-file-regex Return a regexp that matches everything any player (that supports files) can play. -- 2.41.0
