diff options
author | William Xu <william.xwl@gmail.com> | 2013-08-13 19:55:05 +0800 |
---|---|---|
committer | William Xu <william.xwl@gmail.com> | 2013-08-13 19:55:05 +0800 |
commit | 5d8b53a421fd7bf486316a81ee4e7ab0658c17a9 (patch) | |
tree | c7d4b25de9f978c6512ca809989d1dda8897456a /lisp | |
parent | c763540c3473e06405825d6f1679f97b99567de9 (diff) |
(emms-lyrics-set-timer): Don't repeat lyrics already displayed when
resumed.
When resuming from a paused session, played lyrics timers will have a
negative time, but timer-duration is so nice to convert it as
positive, thus messing lyrics display. Check the `time' to fix.
Thanks to Ian D.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/emms-lyrics.el | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lisp/emms-lyrics.el b/lisp/emms-lyrics.el index 6b28b22..fba6825 100644 --- a/lisp/emms-lyrics.el +++ b/lisp/emms-lyrics.el @@ -1,6 +1,6 @@ ;;; emms-lyrics.el --- Display lyrics synchronically -;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Free Software Foundation, Inc. ;; Author: William Xu <william.xwl@gmail.com> ;; Keywords: emms music lyrics @@ -411,17 +411,18 @@ job." (next-lyric (and (cdr lyrics-alist) (cdr (cadr lyrics-alist))))) (setq line (1+ line)) - (setq emms-lyrics-timers - (append emms-lyrics-timers - (list - (run-at-time (format "%d sec" time) - nil - 'emms-lyrics-display-handler - lyric - next-lyric - line - (and next-time (- next-time time))))))) - (setq lyrics-alist (cdr lyrics-alist))))) + (when (> time 0) + (setq emms-lyrics-timers + (append emms-lyrics-timers + (list + (run-at-time (format "%d sec" time) + nil + 'emms-lyrics-display-handler + lyric + next-lyric + line + (and next-time (- next-time time))))))) + (setq lyrics-alist (cdr lyrics-alist)))))) (defun emms-lyrics-mode-line () "Add lyric to the mode line." |