X-Git-Url: https://git.distorted.org.uk/~mdw/profile/blobdiff_plain/a0e7592d945424a95ee299c1f932d77dad824cc1..4aba12fa4cbe02596d77f9437af4f6505c19745d:/el/dot-emacs.el diff --git a/el/dot-emacs.el b/el/dot-emacs.el index c189f4d..5f27085 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -3769,13 +3769,6 @@ there is sadness." ;;;-------------------------------------------------------------------------- ;;; MPC configuration. -(defun mdw-mpc-play-or-pause () - (interactive) - (require 'mpc) - (if (member (cdr (assq 'state (mpc-cmd-status))) '("play")) - (mpc-pause) - (mpc-play))) - (setq mpc-browser-tags '(Artist|Composer|Performer Album|Playlist)) (defun mdw-mpc-now-playing () @@ -3820,9 +3813,21 @@ there is sadness." (t (message "mpd in unknown state `%s'" state))))) -(autoload 'mpc-next "mpc") -(autoload 'mpc-prev "mpc") -(autoload 'mpc-stop "mpc") +(defmacro mdw-define-mpc-wrapper (func bvl interactive &rest body) + `(defun ,func ,bvl + (interactive ,@interactive) + (require 'mpc) + ,@body + (mdw-mpc-now-playing))) + +(mdw-define-mpc-wrapper mdw-mpc-play-or-pause () nil + (if (member (cdr (assq 'state (mpc-cmd-status))) '("play")) + (mpc-pause) + (mpc-play))) + +(mdw-define-mpc-wrapper mdw-mpc-next () nil (mpc-next)) +(mdw-define-mpc-wrapper mdw-mpc-prev () nil (mpc-prev)) +(mdw-define-mpc-wrapper mdw-mpc-stop () nil (mpc-stop)) (defun mdw-mpc-hack-lines (arg interactivep func) (if (and interactivep (use-region-p))