emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Lawrence Mitchell <wence@gmx.li>
To: emacs-orgmode@gnu.org
Cc: Carsten Dominik <C.Dominik@uva.nl>
Subject: [PATCH] Remove org-time-clocksum-use-effort-durations
Date: Tue, 28 May 2013 12:13:21 +0100	[thread overview]
Message-ID: <87ehcr4asu.fsf_-_@gmx.li> (raw)
In-Reply-To: 87ppwkbk08.fsf@bzg.ath.cx

* 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 <wence@gmx.li> 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	other threads:[~2013-05-28 11:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-21  0:32 Effort entry and confusing effort estimates Ken Mankoff
2013-05-21  3:22 ` Ken Mankoff
2013-05-21 10:39   ` Bastien
2013-05-21 11:52     ` Lawrence Mitchell
2013-05-21 12:22       ` Bastien
2013-05-28 11:13         ` Lawrence Mitchell [this message]
2013-05-21 13:10     ` Ken Mankoff

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=87ehcr4asu.fsf_-_@gmx.li \
    --to=wence@gmx.li \
    --cc=C.Dominik@uva.nl \
    --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).