aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwilliam.xwl <william.xwl>2005-10-05 06:48:00 +0000
committerwilliam.xwl <mwolson@gnu.org>2005-10-05 06:48:00 +0000
commit47c874cbc0e9582c19d56fa2176bd2a473148765 (patch)
tree0178708c76648e8f3ab95c7538303368807261e5
parentbba3062997c45ff28186c56e6973651c3a21aa07 (diff)
emms-playing-time.el: New function: `emms-playing-time-restore-mode-line'.
darcs-hash:20051005064846-e8fe6-c4f072868018fe19587c9d264de1d1b4057f85e0.gz
-rw-r--r--emms-playing-time.el14
1 files changed, 10 insertions, 4 deletions
diff --git a/emms-playing-time.el b/emms-playing-time.el
index b864edf..36090e0 100644
--- a/emms-playing-time.el
+++ b/emms-playing-time.el
@@ -72,7 +72,6 @@ should enable `emms-playing-time-display-p' first, though."
(defun emms-playing-time-start ()
"Get ready for display playing time."
(setq emms-playing-time 0)
- (emms-playing-time-mode-line)
(run-at-time t 1 'emms-playing-time-display))
(defun emms-playing-time-stop ()
@@ -100,24 +99,26 @@ should enable `emms-playing-time-display-p' first, though."
"Enable displaying emms playing time on mode line."
(interactive)
(setq emms-playing-time-display-p t)
+ (emms-playing-time-mode-line)
(add-hook 'emms-player-started-hook 'emms-playing-time-start)
(add-hook 'emms-player-stopped-hook 'emms-playing-time-stop)
(add-hook 'emms-player-finished-hook 'emms-playing-time-stop)
(add-hook 'emms-player-paused-hook 'emms-playing-time-pause)
(add-hook 'emms-player-seeked-functions 'emms-playing-time-seek)
- (message "Displaying emms playing time enabled."))
+ (message "emms playing time enabled."))
(defun emms-playing-time-disable ()
"Disable displaying emms playing time on mode line."
(interactive)
- (setq emms-playing-time-display-p nil)
(emms-playing-time-stop)
+ (setq emms-playing-time-display-p nil)
+ (emms-playing-time-restore-mode-line)
(remove-hook 'emms-player-started-hook 'emms-playing-time-start)
(remove-hook 'emms-player-stopped-hook 'emms-playing-time-stop)
(remove-hook 'emms-player-finished-hook 'emms-playing-time-stop)
(remove-hook 'emms-player-paused-hook 'emms-playing-time-pause)
(remove-hook 'emms-player-seeked-functions 'emms-playing-time-seek)
- (message "Displaying emms playing time disabled."))
+ (message "emms playing time disabled."))
(defun emms-playing-time-toggle ()
"Toggle displaying emms playing time on mode line."
@@ -161,6 +162,11 @@ should enable `emms-playing-time-display-p' first, though."
(append global-mode-string
'(emms-playing-time-string)))))
+(defun emms-playing-time-restore-mode-line ()
+ "Restore the mode line."
+ (setq global-mode-string
+ (remove 'emms-playing-time-string global-mode-string))
+ (force-mode-line-update))
(provide 'emms-playing-time)