emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jan Malakhovski <oxij@oxij.org>
To: emacs-orgmode@gnu.org
Cc: Jan Malakhovski <oxij@oxij.org>
Subject: [PATCH 1/4] org: move `org-duration-string-to-minutes' to a better place
Date: Sun, 27 Dec 2015 15:13:46 +0000	[thread overview]
Message-ID: <1451229229-18973-2-git-send-email-oxij@oxij.org> (raw)
In-Reply-To: <1451229229-18973-1-git-send-email-oxij@oxij.org>

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

diff --git a/lisp/org.el b/lisp/org.el
index 74d1c4c..f6c513e 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -18303,6 +18303,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?
 
@@ -18361,26 +18381,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.6.4

  reply	other threads:[~2015-12-27 15:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-27 15:13 [PATCH v3 part3 0/4] fixing org-clock-time% Jan Malakhovski
2015-12-27 15:13 ` Jan Malakhovski [this message]
2015-12-27 15:13 ` [PATCH 2/4] rename `org-duration-string-to-minutes' to `org-clocksum-string-to-minutes' everywhere Jan Malakhovski
2015-12-27 15:13 ` [PATCH 3/4] simplify and document `org-effort-durations'-related code Jan Malakhovski
2015-12-27 15:13 ` [PATCH 4/4] org-clock: make clock table respect `org-effort-durations' Jan Malakhovski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1451229229-18973-2-git-send-email-oxij@oxij.org \
    --to=oxij@oxij.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).