From dd27018420c752d12dfed40d52990bab340dde1c Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sat, 27 Jun 2020 10:16:53 +0200 Subject: [PATCH] Rename main music hydra and move it to `db-music' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `db-music' package is supposed to be an abstract interface to music functionality, and should thus define the main hydra for this. Moreover, the hydra should not contain „emms“ in it's name, although it's using only EMMS functions. It's not clear whether EMMS will every be replaced by some other backend, but it's nicer to have a (more or less) clear separation between user frontend and implementation backend. --- init.el | 8 ++++---- site-lisp/db-emms.el | 24 ------------------------ site-lisp/db-music.el | 22 ++++++++++++++++++++++ 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/init.el b/init.el index 47617ae..1644a85 100644 --- a/init.el +++ b/init.el @@ -191,7 +191,7 @@ (bind-key "C-c i" #'ispell-change-dictionary) (bind-key "C-c j" #'avy-goto-char-timer) (bind-key "C-c l" #'org-store-link) - (bind-key "C-c m" #'emms-control/body) + (bind-key "C-c m" #'music-control/body) (bind-key "C-c o" #'hydra-org-clock/body) (bind-key "C-c s" #'synonyms) (bind-key "C-h C-f" #'find-function) @@ -2094,8 +2094,7 @@ With given ARG, display files in `db/important-document-path’." (use-package db-emms :commands (db/emms-source-file-directory-tree-find db/emms-track-description - db/emms-playlist-mode-insert-track - emms-control/body)) + db/emms-playlist-mode-insert-track)) (use-package helm-emms :pin "melpa-stable" @@ -2114,7 +2113,8 @@ With given ARG, display files in `db/important-document-path’." "--metadata db-playlist=include"))) :commands (db/play-auto-playlist db/playlist-files-from-git-annex-find - db/play-auto-playlist-from-git-annex-find)) + db/play-auto-playlist-from-git-annex-find + music-control/body)) ;; * Shells and such diff --git a/site-lisp/db-emms.el b/site-lisp/db-emms.el index 856cce1..570c691 100644 --- a/site-lisp/db-emms.el +++ b/site-lisp/db-emms.el @@ -10,7 +10,6 @@ (require 'emms-source-file) (require 'emms-playlist-mode) (require 'emms-volume) -(require 'hydra) ;; Custom file finder @@ -84,9 +83,6 @@ When NO-NEWLINE is non-nil, do not insert a newline after the track." (unless no-newline (insert "\n")))) - -;; Hydra - (defun db/emms-track-status () "Return string displaying status of currently played track." (require 'emms) @@ -95,26 +91,6 @@ When NO-NEWLINE is non-nil, do not insert a newline after the track." (emms-playlist-current-selected-track))) "«nothing»")) -(defhydra emms-control (:color red :hint none) - " -Playing: %s(db/emms-track-status) - - _n_: ?n? _p_: ?p? -_RET_: ?RET? _M_: ?M? - _-_: lower volume _+_: ?+? - _P_: ?P? - -" - ("n" emms-next "next") - ("p" emms-previous "previous") - ("RET" emms-pause "play/pause") - ("s" emms-show "show title") - ("-" emms-volume-lower "lower volume") - ("+" emms-volume-raise "raise volume") - ("M" emms "show playlist") - ("P" (db/play-auto-playlist) - "Play automatically generated playlist")) - ;; End diff --git a/site-lisp/db-music.el b/site-lisp/db-music.el index 03179e0..e40162c 100644 --- a/site-lisp/db-music.el +++ b/site-lisp/db-music.el @@ -9,6 +9,8 @@ (require 'seq) (require 'emms) (require 'emms-source-file) +(require 'hydra) +(require 'db-emms) (defgroup db-music nil "General configurations for music-related functionality." @@ -91,6 +93,26 @@ See `db/playlist-files-from-git-annex-find’ for more details." (db/-emms-playlist-from-files (call-interactively #'db/playlist-files-from-git-annex-find))) +(defhydra music-control (:color red :hint none) + " +Playing: %s(db/emms-track-status) + + _n_: ?n? _p_: ?p? +_RET_: ?RET? _M_: ?M? + _-_: lower volume _+_: ?+? + _P_: ?P? + +" + ("n" emms-next "next") + ("p" emms-previous "previous") + ("RET" emms-pause "play/pause") + ("s" emms-show "show title") + ("-" emms-volume-lower "lower volume") + ("+" emms-volume-raise "raise volume") + ("M" emms "show playlist") + ("P" (db/play-auto-playlist) + "Play automatically generated playlist")) + (provide 'db-music) ;;; db-music ends here