From: Tim Vaughan Date: Sun, 22 Apr 2018 09:25:41 +0000 (+0200) Subject: Figuring out customization groups. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=eb93f79afd534728fb10653f030dae8b33da817a;p=emus.git Figuring out customization groups. --- diff --git a/emus.el b/emus.el index d53f430..c66aed3 100644 --- a/emus.el +++ b/emus.el @@ -5,14 +5,43 @@ ;; Keywords: multimedia ;; URL: http://github.com/tgvaughan/emus -;; Commentary: +;;; Commentary: ;; This is a simple package for playing audio from a local library ;; of audio files. -;;;###autoload +;;; Code: + +(defgroup emus nil + "Simple music player for Emacs inspired by CMUS." + :group 'multimedia) + +(defcustom emus-directory "~/Music/" + "Directory containing audio files for emus." + :type 'string + :group 'emus) + +(defcustom emus-mpg123-excecutable "mpg123" + "Name of (and, optionally, path to) mpg123 binary." + :type 'string + :group 'emus) + +(defun emus-get-audio-files () + "Get all mp3 files in main emus directory." + (directory-files-recursively emus-directory ".*\\.mp3")) + (defun emus () "Switch to *emus* audio library buffer." (interactive) (switch-to-buffer "*emus*") (emus-mode)) + +(define-derived-mode emus-mode special-mode "Emus" + "Major mode for EMUS music player." + + (setq-local default-directory emus-directory) + + (let ((player (make-process :name "mpg123" :command '(emus-mpg123-excecutable "-R")))) + (process-send-string player "load The Midnight - Endless Summer - 01 Endless Summer.mp3\n"))) + +;;; emus.el ends here