emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH 2/4] org: move org-duration-string-to-minutes to a better pla


From: Jan Malakhovski
Subject: [O] [PATCH 2/4] org: move org-duration-string-to-minutes to a better place
Date: Sun, 25 Oct 2015 12:48:11 +0000

---
 lisp/org.el | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 088913c..453ed37 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -18329,6 +18329,26 @@ If no number is found, the return value is 0."
     (string-to-number (match-string 1 s)))
    (t 0)))
 
+(defun org-duration-string-to-minutes (s &optional output-to-string)
+  "Convert a duration string S to minutes.
+
+A bare number is interpreted as minutes, modifiers can be set by
+customizing `org-effort-durations' (which see).
+
+Entries containing a colon are interpreted as H:MM by
+`org-hh:mm-string-to-minutes'."
+  (let ((result 0)
+       (re (concat "\\([0-9.]+\\) *\\("
+                   (regexp-opt (mapcar 'car org-effort-durations))
+                   "\\)")))
+    (while (string-match re s)
+      (incf result (* (cdr (assoc (match-string 2 s) org-effort-durations))
+                     (string-to-number (match-string 1 s))))
+      (setq s (replace-match "" nil t s)))
+    (setq result (floor result))
+    (incf result (org-hh:mm-string-to-minutes s))
+    (if output-to-string (number-to-string result) result)))
+
 (defcustom org-image-actual-width t
   "Should we use the actual width of images when inlining them?
 
@@ -18387,26 +18407,6 @@ The value is a list, with zero or more of the symbols 
`effort', `appt',
   :package-version '(Org . "8.3")
   :group 'org-agenda)
 
-(defun org-duration-string-to-minutes (s &optional output-to-string)
-  "Convert a duration string S to minutes.
-
-A bare number is interpreted as minutes, modifiers can be set by
-customizing `org-effort-durations' (which see).
-
-Entries containing a colon are interpreted as H:MM by
-`org-hh:mm-string-to-minutes'."
-  (let ((result 0)
-       (re (concat "\\([0-9.]+\\) *\\("
-                   (regexp-opt (mapcar 'car org-effort-durations))
-                   "\\)")))
-    (while (string-match re s)
-      (incf result (* (cdr (assoc (match-string 2 s) org-effort-durations))
-                     (string-to-number (match-string 1 s))))
-      (setq s (replace-match "" nil t s)))
-    (setq result (floor result))
-    (incf result (org-hh:mm-string-to-minutes s))
-    (if output-to-string (number-to-string result) result)))
-
 ;;;; Files
 
 (defun org-save-all-org-buffers ()
-- 
2.5.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]