aboutsummaryrefslogtreecommitdiff
path: root/lisp/emms-playing-time.el
diff options
context:
space:
mode:
authorYoni Rabkin <yoni@rabkins.net>2019-06-19 13:28:12 -0400
committerYoni Rabkin <yoni@rabkins.net>2019-06-19 13:28:12 -0400
commitd913726a127ecd8f956f02be785f258f042aa384 (patch)
tree3f7ae2054d676343e4240a2b264797281aee3115 /lisp/emms-playing-time.el
parentf7e27094f09432b40ced77c7163cd29f338b7db6 (diff)
* lisp/emms-playing-time.el: add count-down style.
Diffstat (limited to 'lisp/emms-playing-time.el')
-rw-r--r--lisp/emms-playing-time.el18
1 files changed, 15 insertions, 3 deletions
diff --git a/lisp/emms-playing-time.el b/lisp/emms-playing-time.el
index 9c4f96a..01ea380 100644
--- a/lisp/emms-playing-time.el
+++ b/lisp/emms-playing-time.el
@@ -1,8 +1,8 @@
;;; emms-playing-time.el --- Display emms playing time on mode line
-;; Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2019 Free Software Foundation, Inc.
-;; Author: William Xu <william.xwl@gmail.com>
+;; Author: William Xu <william.xwl@gmail.com>, Yoni Rabkin (yrk@gnu.org)
;; This file is part of EMMS.
@@ -62,7 +62,9 @@ e.g., display 02:37 instead of 02:37/05:49."
(defcustom emms-playing-time-style 'time
"Style used for displaying playing time.
-Valid styles are `time' (e.g., 01:30/4:20) and `bar' (e.g., [===> ])."
+Valid styles are `time' (e.g., 01:30/4:20),
+ `bar' (e.g., [===> ]),
+and `downtime' (e.g. -03:58)."
:type 'symbol
:group 'emms-playing-time)
@@ -178,6 +180,16 @@ could call `emms-playing-time-enable-display' and
(total-min-only (/ total-playing-time 60))
(total-sec-only (% total-playing-time 60)))
(cl-case emms-playing-time-style
+ ((downtime) ; `downtime' style
+ (setq emms-playing-time-string
+ (emms-replace-regexp-in-string
+ " " "0"
+ (if (or emms-playing-time-display-short-p
+ ;; unable to get total playing-time
+ (eq total-playing-time 0))
+ (format "%2d:%2d" min sec)
+ (format "-%2d:%2d"
+ (- total-min-only min) (- total-sec-only sec))))))
((bar) ; `bar' style
(if (zerop total-playing-time)
(setq emms-playing-time-string "[==>........]")