emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [PATCH] Separate clocksum format for durations >= 1 day


From: Nicolas Goaziou
Subject: Re: [O] [PATCH] Separate clocksum format for durations >= 1 day
Date: Thu, 08 Nov 2012 01:26:48 +0100

Toby Cubitt <address@hidden> writes:

> But that only needs to parse clock strings stored in properties/drawers,
> not the ones displayed in overlays (column view) or in the mode-line.

Correct.

> Are the clock strings stored in properties/drawers formatted using the
> existing org-time-clocksum-* defcustoms? I can't easily tell from the
> org-clock.el code...
>
> The only sane answer ought to be "no" (which doesn't mean that it is ;)
> It would clearly be better if the clock strings stored in org buffers
> used a single fixed format, which could be mangled as desired for display
> in overlays and the mode-line.

Format string for clock lines is hard-coded (see line 1493 in
org-clock.el), which means we don't have to limit ourselves to
parse-able format. Back to point 1.

Then, I'm fine with format strings. Following your suggestion, what
about the following variables:
- one to determine format of data: fractional or regular.
- one to determine display format. Its value would be a list of 3 format
  strings associated to days, hours and minutes.

Internally, the duration is computed as a list of three integers or nil
if data is regular, or a list of one float and two nil if data is
fractional. Format strings from the second variable will be concatenated
only when value is non-nil. If no format string is found for a given
unit, it's value will be converted into a lesser unit.

Examples:

| var1        | var2                        | internal representation | display 
    |
|-------------+-----------------------------+-------------------------+-------------|
| 'regular    | ("%dd " "%d h " "%d min")   | (nil 11 35)             | 11 h 35 
min |
| 'fractional | ("%.2fd" "%.2fh" "%.2fmin") | (nil 11.3 nil)          | 11.30h  
    |
| 'regular    | ("%dd " "%d:" "%02d")       | (1 3 5)                 | 1d 3:05 
    |
| 'regular    | (nil "%d:" "%02d")          | (1 3 5)                 | 27:05   
    |

We can extend it to years if needed.


Regards,

-- 
Nicolas Goaziou



reply via email to

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