emacs-orgmode
[Top][All Lists]
Advanced

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

[O] [PATCH] Remove org-time-clocksum-use-effort-durations


From: Lawrence Mitchell
Subject: [O] [PATCH] Remove org-time-clocksum-use-effort-durations
Date: Tue, 28 May 2013 12:13:21 +0100
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

* lisp/org.el (org-time-clocksum-use-effort-durations): Remove
variable.
(org-minutes-to-clocksum-string): Remove references.
* lisp/org-clock.el (org-clocktable-write-default): Remove
references.

We would like the following identity to hold:

    (= (org-duration-string-to-minutes "3d 2h")
       (org-duration-string-to-minutes
         (org-minutes-to-clocksum-string
           (org-duration-string-to-minutes "3d 2h")))))

Previously, this was only true if org-time-clocksum-use-effort-durations
was non-nil (not the default), since org-duration-string-to-minutes
unconditionally looks at org-effort-durations, whereas
org-minutes-to-clocksum-string only considers it if
org-time-clocksum-use-effort-durations is non-nil.  To remove
confusion, since org uses org-effort-durations unconditionally
everywhere else when interpreting duration strings, just remove this
customisation option and use org-effort-durations in
org-minutes-to-clocksum-string as well.
---
 lisp/org-clock.el |  2 --
 lisp/org.el       | 32 ++++++--------------------------
 2 files changed, 6 insertions(+), 28 deletions(-)

Bastien wrote:
> Hi Lawrence,

> Lawrence Mitchell <address@hidden> writes:

>> I would argue that

>> (org-duration-string-to-minutes
>>   (org-minutes-to-clocksum-string
>>     (org-duration-string-to-minutes some-value)))

>> Should be a no-op.  But that is only the case if
>> org-time-clocksum-use-effort-durations is t.

> Agreed.  Thanks for the clear explanations.  Can you provide a patch
> to get the correct behavior?  At the time, I could not closely watch
> the side-effect of introducing `org-time-clocksum-use-effort-durations'
> and this is clearly one of them.

Here we go.  I think the right thing to do is just remove
org-time-clocksum-use-effort-durations completely.  If this is
wanted, I can add the appropriate entry to ORG-NEWS as well.

Lawrence

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 8ac215e..cc6b9c1 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2337,8 +2337,6 @@ from the dynamic block definition."
         (maxlevel (or (plist-get params :maxlevel) 3))
         (emph (plist-get params :emphasize))
         (level-p (plist-get params :level))
-        (org-time-clocksum-use-effort-durations
-         (plist-get params :effort-durations))
         (timestamp (plist-get params :timestamp))
         (properties (plist-get params :properties))
         (ntcol (max 1 (or (plist-get params :tcolumns) 100)))
diff --git a/lisp/org.el b/lisp/org.el
index adb5fb1..581536d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2978,20 +2978,6 @@ See `org-time-clocksum-format' for more on time clock 
formats."
   :version "24.3"
   :type 'boolean)
 
-(defcustom org-time-clocksum-use-effort-durations nil
-  "When non-nil, \\[org-clock-display] uses effort durations.
-E.g. by default, one day is considered to be a 8 hours effort,
-so a task that has been clocked for 16 hours will be displayed
-as during 2 days in the clock display or in the clocktable.
-
-See `org-effort-durations' on how to set effort durations
-and `org-time-clocksum-format' for more on time clock formats."
-  :group 'org-time
-  :group 'org-clock
-  :version "24.4"
-  :package-version '(Org . "8.0")
-  :type 'boolean)
-
 (defcustom org-time-clocksum-fractional-format "%.2f"
   "The format string used when creating CLOCKSUM lines,
 or when Org mode generates a time duration, if
@@ -17521,21 +17507,15 @@ effort string \"2hours\" is equivalent to 120 
minutes."
   "Format number of minutes as a clocksum string.
 The format is determined by `org-time-clocksum-format',
 `org-time-clocksum-use-fractional' and
-`org-time-clocksum-fractional-format' and
-`org-time-clocksum-use-effort-durations'."
+`org-time-clocksum-fractional-format'."
   (let ((clocksum "")
        (m (round m)) ; Don't allow fractions of minutes
        h d w mo y fmt n)
-    (setq h (if org-time-clocksum-use-effort-durations
-               (cdr (assoc "h" org-effort-durations)) 60)
-         d (if org-time-clocksum-use-effort-durations
-               (/ (cdr (assoc "d" org-effort-durations)) h) 24)
-         w (if org-time-clocksum-use-effort-durations
-               (/ (cdr (assoc "w" org-effort-durations)) (* d h)) 7)
-         mo (if org-time-clocksum-use-effort-durations
-                (/ (cdr (assoc "m" org-effort-durations)) (* d h)) 30)
-         y (if org-time-clocksum-use-effort-durations
-               (/ (cdr (assoc "y" org-effort-durations)) (* d h)) 365))
+    (setq h (or (cdr (assoc "h" org-effort-durations)) 60)
+         d (or (/ (cdr (assoc "d" org-effort-durations)) h) 24)
+         w (or (/ (cdr (assoc "w" org-effort-durations)) (* d h)) 7)
+         mo (or (/ (cdr (assoc "m" org-effort-durations)) (* d h)) 30)
+         y (or (/ (cdr (assoc "y" org-effort-durations)) (* d h)) 365))
     ;; fractional format
     (if org-time-clocksum-use-fractional
        (cond
-- 
1.8.2-rc3




reply via email to

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