diff options
author | Michael Olson <mwolson@gnu.org> | 2006-04-01 21:06:00 +0000 |
---|---|---|
committer | Michael Olson <mwolson@gnu.org> | 2006-04-01 21:06:00 +0000 |
commit | bf80e02cd233409d56580bf38cc76ef58fc0f24e (patch) | |
tree | 158eb8b46b13313cc396d953784533aff17e6ee7 /emms-score.el | |
parent | f2c85795a7b5c7e992b08c889ad563bce56f9ae2 (diff) |
Make all add-on files toggle-able.
darcs-hash:20060401210634-1bfb2-6a8f735119b68c6ab80d503910ec0105680fec73.gz
Diffstat (limited to 'emms-score.el')
-rw-r--r-- | emms-score.el | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/emms-score.el b/emms-score.el index de72c2b..891866f 100644 --- a/emms-score.el +++ b/emms-score.el @@ -63,6 +63,8 @@ (defvar emms-score-min-score 0) (defvar emms-score-default-score 0) (defvar emms-score-hash (make-hash-table :test 'equal)) +(defvar emms-score-enabled-p nil + "If non-nil, emms score is active.") (defcustom emms-score-file "~/.emms/scores" "*Directory to store the score file." @@ -78,15 +80,39 @@ off otherwise." (interactive "p") (if (and arg (> arg 0)) (progn + (setq emms-score-enabled-p t) (emms-score-load-hash) (remove-hook 'emms-player-finished-hook 'emms-next-noerror) (add-hook 'emms-player-finished-hook 'emms-score-next-noerror) (add-hook 'kill-emacs-hook 'emms-score-save-hash)) + (setq emms-score-enabled-p nil) (emms-score-save-hash) (remove-hook 'emms-player-finished-hook 'emms-score-next-noerror) (add-hook 'emms-player-finished-hook 'emms-next-noerror) (remove-hook 'kill-emacs-hook 'emms-score-save-hash))) +;;;###autoload +(defun emms-score-enable () + "Turn on emms-score." + (interactive) + (emms-score 1) + (message "emms score enabled")) + +;;;###autoload +(defun emms-score-disable () + "Turn off emms-score." + (interactive) + (emms-score -1) + (message "emms score disabled")) + +;;;###autoload +(defun emms-score-toggle () + "Toggle emms-score." + (interactive) + (if emms-score-enabled-p + (emms-score-disable) + (emms-score-enable))) + (defun emms-score-change-mood (mood) "Change the current MOOD. The score hash is automatically saved." |