aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Olson <mwolson@gnu.org>2006-01-04 06:10:00 +0000
committerMichael Olson <mwolson@gnu.org>2006-01-04 06:10:00 +0000
commit7fe71e6381915e775deed571f7b5c0babdf0f394 (patch)
tree1e8a2b50a9a1e80748917a8c093fd604aee28bda
parent76389c6781d42947ce36fa8b260391935532a941 (diff)
Use timers in a way that is compatible with both Emacs and XEmacs.
darcs-hash:20060104061024-1bfb2-a35972f84a96c27a9a4bee6a245a8cbe2d6a8dd1.gz
-rw-r--r--emms-lyrics.el2
-rw-r--r--emms-playing-time.el8
-rw-r--r--emms.el8
3 files changed, 15 insertions, 3 deletions
diff --git a/emms-lyrics.el b/emms-lyrics.el
index 7f17981..ebbfc12 100644
--- a/emms-lyrics.el
+++ b/emms-lyrics.el
@@ -178,7 +178,7 @@ To find FILE, will look up in current directory and `emms-lyrics-dir'."
"Stop displaying lyrics."
(interactive)
(when emms-lyrics-alist
- (cancel-function-timers 'emms-lyrics-display)
+ (mapc #'emms-cancel-timer emms-lyrics-timers)
(if (or (not emms-player-paused-p)
emms-player-stopped-p)
(setq emms-lyrics-alist nil
diff --git a/emms-playing-time.el b/emms-playing-time.el
index 36090e0..ad2da90 100644
--- a/emms-playing-time.el
+++ b/emms-playing-time.el
@@ -69,6 +69,8 @@ should enable `emms-playing-time-display-p' first, though."
(defvar emms-playing-time-string "")
+(defvar emms-playing-time-display-timer nil)
+
(defun emms-playing-time-start ()
"Get ready for display playing time."
(setq emms-playing-time 0)
@@ -81,13 +83,15 @@ should enable `emms-playing-time-display-p' first, though."
(progn
(setq emms-playing-time-string "")
(force-mode-line-update)))
- (cancel-function-timers 'emms-playing-time-display))
+ (emms-cancel-timer emms-playing-time-display-timer)
+ (setq emms-playing-time-display-timer nil))
(defun emms-playing-time-pause ()
"Pause playing time."
(if emms-player-paused-p
(emms-playing-time-stop)
- (run-at-time t 1 'emms-playing-time-display)))
+ (setq emms-playing-time-display-timer
+ (run-at-time t 1 'emms-playing-time-display))))
(defun emms-playing-time-seek (sec)
"Seek forward or backward SEC playing time."
diff --git a/emms.el b/emms.el
index 73dfd86..e17f8eb 100644
--- a/emms.el
+++ b/emms.el
@@ -363,6 +363,14 @@ See `emms-repeat-track'."
(when (not emms-player-playing-p)
(error "No EMMS player playing right now")))
+(defun emms-cancel-timer (timer)
+ "Cancel the given TIMER."
+ (when timer
+ (cond ((fboundp 'cancel-timer)
+ (cancel-timer timer))
+ ((fboundp 'delete-itimer)
+ (delete-itimer timer)))))
+
;;; Tracks