emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-timer.el: Use hh:mm:ss format instead of minutes
@ 2015-04-24 12:48 Brice Waegenire
  2015-04-24 16:49 ` Kyle Meyer
  0 siblings, 1 reply; 12+ messages in thread
From: Brice Waegenire @ 2015-04-24 12:48 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 280 bytes --]

Hello,

I've hacked a patch that use hh:mm:ss format instead of minutes for
org-timer-set-timer. I'm really not sure I did it in the right way,
any sugestions are welcome.
Both tests test-org-timer/set-timer andtest-org-timer/pause-timer
where adapted to the new format.


Brice.

[-- Attachment #2: 0001-org-timer.el-Use-hh-mm-ss-format-instead-of-minutes.patch --]
[-- Type: text/x-diff, Size: 2645 bytes --]

From 18bf5a0c3e2a1101ece7d83a201eb8f6ac19836d Mon Sep 17 00:00:00 2001
From: Brice Waegeneire <brice.wge@gmail.com>
Date: Fri, 24 Apr 2015 14:18:45 +0200
Subject: [PATCH] org-timer.el: Use hh:mm:ss format instead of minutes

* lisp/org-timer.el (org-timer-set-timer): Use hh:mm:ss format instead of minutes.

* testing/lisp/test-org-timer.el (test-org-timer/set-timer, test-org-timer/pause-timer): Change the arguments to the new format.

TINYCHANGE
---
 lisp/org-timer.el              | 11 ++++-------
 testing/lisp/test-org-timer.el |  4 ++--
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/lisp/org-timer.el b/lisp/org-timer.el
index 0593573..4df21d2 100644
--- a/lisp/org-timer.el
+++ b/lisp/org-timer.el
@@ -429,17 +429,14 @@ using three `C-u' prefix arguments."
 	 (minutes (or (and (not (equal opt '(64)))
 			   effort-minutes
 			   (number-to-string effort-minutes))
-		     (and (numberp opt) (number-to-string opt))
-		     (and (listp opt) (not (null opt))
-			  (number-to-string org-timer-default-timer))
+		     (and (stringp opt) (prin1 opt))
 		     (read-from-minibuffer
-		      "How many minutes left? "
+		      "How many time left? "
 		      (if (not (eq org-timer-default-timer 0))
-			  (number-to-string org-timer-default-timer))))))
+			  (prin1 org-timer-default-timer))))))
     (if (not (string-match "[0-9]+" minutes))
 	(org-timer-show-remaining-time)
-      (let* ((mins (string-to-number (match-string 0 minutes)))
-	     (secs (* mins 60))
+      (let* ((secs (org-timer-hms-to-secs (org-timer-fix-incomplete minutes)))
 	     (hl (org-timer--get-timer-title)))
 	(if (or (not org-timer-countdown-timer)
 		(equal opt '(16))
diff --git a/testing/lisp/test-org-timer.el b/testing/lisp/test-org-timer.el
index 7164a5d..a6d5e7a 100644
--- a/testing/lisp/test-org-timer.el
+++ b/testing/lisp/test-org-timer.el
@@ -175,7 +175,7 @@ Also, mute output from `message'."
    (equal "0:06:34"
 	  (test-org-timer/with-temp-text ""
 	    (test-org-timer/with-current-time test-org-timer/time0
-	      (org-timer-set-timer 10))
+	      (org-timer-set-timer "10:00"))
 	    (test-org-timer/with-current-time test-org-timer/time1
 	      (org-timer))
 	    (org-trim (buffer-string))))))
@@ -210,7 +210,7 @@ Also, mute output from `message'."
    (equal "0:01:39"
 	  (test-org-timer/with-temp-text ""
 	    (test-org-timer/with-current-time test-org-timer/time0
-	      (org-timer-set-timer 10))
+	      (org-timer-set-timer "10:00"))
 	    (test-org-timer/with-current-time test-org-timer/time1
 	      (org-timer-pause-or-continue))
 	    (test-org-timer/with-current-time test-org-timer/time2
-- 
2.3.5


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-08-05  0:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-24 12:48 [PATCH] org-timer.el: Use hh:mm:ss format instead of minutes Brice Waegenire
2015-04-24 16:49 ` Kyle Meyer
2015-04-29 21:52   ` Brice Waegenire
2015-04-30  0:38     ` Kyle Meyer
2015-05-01  8:47     ` Nicolas Goaziou
2015-05-05 14:34       ` Brice Waegenire
2015-05-07 20:09         ` Nicolas Goaziou
2015-06-02 21:04           ` Brice Waegenire
2015-06-02 21:24             ` Nicolas Goaziou
2015-06-03 22:00               ` Brice Waegenire
2015-06-06  7:30                 ` Nicolas Goaziou
2015-08-05  0:00                   ` Bastien Guerry

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).