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

2012-11-21 Thread Mike McLean
On Tuesday, November 20, 2012, Nicolas Goaziou wrote: Toby Cubitt ts...@cantab.net javascript:; writes: Instead of changing org-hours-to-clocksum-string, it's probably preferable to make org-minutes-to-clocksum-string more robust, so it copes correctly with floating point arguments.

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

2012-11-20 Thread Mike McLean
On Sat, Nov 17, 2012 at 11:02 AM, Toby Cubitt ts...@cantab.net wrote: On Sat, Nov 17, 2012 at 03:42:24PM +0100, Nicolas Goaziou wrote: Toby Cubitt ts...@cantab.net writes: I've replaced the cons cells with additional plist properties, as you suggested. The resulting customization ui

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

2012-11-20 Thread Toby Cubitt
On Tue, Nov 20, 2012 at 11:12:10AM -0500, Mike McLean wrote: On Sat, Nov 17, 2012 at 11:02 AM, Toby Cubitt ts...@cantab.net wrote: On Sat, Nov 17, 2012 at 03:42:24PM +0100, Nicolas Goaziou wrote: Toby Cubitt ts...@cantab.net writes: I've replaced the cons cells with additional plist

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

2012-11-20 Thread Nicolas Goaziou
Toby Cubitt ts...@cantab.net writes: Instead of changing org-hours-to-clocksum-string, it's probably preferable to make org-minutes-to-clocksum-string more robust, so it copes correctly with floating point arguments. The attached patch does this. Sorry for letting this slip through.

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

2012-11-17 Thread Nicolas Goaziou
Toby Cubitt ts...@cantab.net writes: Here's an updated patch. Now both org-time-clocksum-format and org-time-clocksum-fractional-format can be plists, as discussed. That was quick. Thank you. In the org-time-clocksum-format case, I made the values cons cells which specify both a format

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

2012-11-17 Thread Toby Cubitt
On Sat, Nov 17, 2012 at 09:48:09AM +0100, Nicolas Goaziou wrote: Toby Cubitt ts...@cantab.net writes: Here's an updated patch. Now both org-time-clocksum-format and org-time-clocksum-fractional-format can be plists, as discussed. That was quick. Thank you. In the

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

2012-11-17 Thread Nicolas Goaziou
Toby Cubitt ts...@cantab.net writes: I've replaced the cons cells with additional plist properties, as you suggested. The resulting customization ui still isn't wonderful in my opinion. But it does the job, and I'm not sure how much scope there is for improving it further. If you see a way,

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

2012-11-17 Thread Toby Cubitt
On Sat, Nov 17, 2012 at 03:42:24PM +0100, Nicolas Goaziou wrote: Toby Cubitt ts...@cantab.net writes: I've replaced the cons cells with additional plist properties, as you suggested. The resulting customization ui still isn't wonderful in my opinion. But it does the job, and I'm not sure

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

2012-11-16 Thread Toby Cubitt
On Wed, Nov 14, 2012 at 05:20:14PM +0100, Toby Cubitt wrote: On Wed, Nov 14, 2012 at 05:09:38PM +0100, Nicolas Goaziou wrote: Toby Cubitt ts...@cantab.net writes: I can easily allow org-time-clocksum-fractional-format to be a list of formats. But 1d 3.4h doesn't seem very useful to me.

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

2012-11-14 Thread Nicolas Goaziou
Toby Cubitt ts...@cantab.net writes: Thanks for your work. Some comments below. The second patch: - further extends org-time-clocksum-format to allow separate month and year components (where a month is taken to be 30 days, a year to be 365 days). I suggest to add week instead of month,

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

2012-11-14 Thread Toby Cubitt
On Wed, Nov 14, 2012 at 04:04:05PM +0100, Nicolas Goaziou wrote: Toby Cubitt ts...@cantab.net writes: Thanks for your work. Some comments below. The second patch: - further extends org-time-clocksum-format to allow separate month and year components (where a month is taken to be 30

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

2012-11-14 Thread Nicolas Goaziou
Toby Cubitt ts...@cantab.net writes: I can easily allow org-time-clocksum-fractional-format to be a list of formats. But 1d 3.4h doesn't seem very useful to me. Probably it should work a bit differently: format the time as a fractional quantity, using the largest time unit which will give a

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

2012-11-14 Thread Toby Cubitt
On Wed, Nov 14, 2012 at 05:09:38PM +0100, Nicolas Goaziou wrote: Toby Cubitt ts...@cantab.net writes: I can easily allow org-time-clocksum-fractional-format to be a list of formats. But 1d 3.4h doesn't seem very useful to me. Probably it should work a bit differently: format the time as a

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

2012-11-13 Thread Toby Cubitt
Attached is a new two-patch series implementing finer-grained control over the format of clocksum durations (only in overlays and the mode-line; the format of the CLOCK entries stored in org files remains unchanged and hard-coded, as before). The first patch: - defines a new

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

2012-11-09 Thread Nicolas Goaziou
Toby Cubitt ts...@cantab.net writes: Minor point: I would order the format strings minutes, hours, days. In case we ever want to extend to months or years, that way we can simply extend the list and it will be completely backwards compatible. Using a plist can circumvent the problem, too. I'm

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

2012-11-08 Thread Toby Cubitt
On Thu, Nov 08, 2012 at 01:26:48AM +0100, Nicolas Goaziou wrote: 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. Good. That's what I thought. Then, I'm fine with format strings.

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

2012-11-07 Thread Nicolas Goaziou
Toby Cubitt ts...@cantab.net 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-*

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

2012-11-06 Thread Toby Cubitt
On Mon, Nov 05, 2012 at 11:45:24PM +0100, Nicolas Goaziou wrote: Toby Cubitt ts...@cantab.net writes: This is not far from your own suggestion to provide different functions depending on which output is desired, I just happen to think that these functions would all be so similar that they

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

2012-11-06 Thread Nicolas Goaziou
Toby Cubitt ts...@cantab.net writes: I still think functions are the way to go. Three options in the defcustom: - One to provide regular time (i.e 14:40 or 3d 18:32) - One to provide decimal time with the highest unit available (i.e. 18,75 h or 2,5 d). - One free slot for an

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

2012-11-06 Thread Toby Cubitt
On Tue, Nov 06, 2012 at 11:57:25AM +0100, Nicolas Goaziou wrote: Toby Cubitt ts...@cantab.net writes: I still think functions are the way to go. Three options in the defcustom: - One to provide regular time (i.e 14:40 or 3d 18:32) - One to provide decimal time with the highest

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

2012-11-06 Thread Nicolas Goaziou
Toby Cubitt ts...@cantab.net writes: How do I produce the format 5 h 32 min with your defcustom, without requiring the user to define their own function? (Assuming that 'regular produces the current default 5:32 format.) Why without defining their own function? My proposal was to use

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

2012-11-06 Thread Toby Cubitt
On Tue, Nov 06, 2012 at 01:29:02PM +0100, Nicolas Goaziou wrote: Toby Cubitt ts...@cantab.net writes: How do I produce the format 5 h 32 min with your defcustom, without requiring the user to define their own function? (Assuming that 'regular produces the current default 5:32 format.)

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

2012-11-06 Thread Nicolas Goaziou
Toby Cubitt ts...@cantab.net writes: 4. We replace the existing muddle with two defcustoms, one selecting regular or decimal (or user-defined function), and one specifying a list of standard format strings that the function can choose between, depending on the duration. No custom

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

2012-11-06 Thread Achim Gratz
Nicolas Goaziou writes: Again, these are strange and very limiting rules. What if I want to have 5 h 32 min? And 5,3 days? You provide a format string like you do now. Achim didn't specify how he conceives the FMT argument. I thought that's obvious: the canned formats (the ones you'd want to

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

2012-11-06 Thread Toby Cubitt
On Tue, Nov 06, 2012 at 06:41:06PM +0100, Nicolas Goaziou wrote: Toby Cubitt ts...@cantab.net writes: 4. We replace the existing muddle with two defcustoms, one selecting regular or decimal (or user-defined function), and one specifying a list of standard format strings that the

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

2012-11-06 Thread Nicolas Goaziou
Toby Cubitt ts...@cantab.net writes: I doubt it can be done now, since we already allow user-defined format strings. I'm more focused on what we will be able to do. Where are displayed durations formatted with org-time-clocksum-format et al. parsed back to a number of minutes in the current

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

2012-11-06 Thread Toby Cubitt
On Tue, Nov 06, 2012 at 07:42:54PM +0100, Achim Gratz wrote: Nicolas Goaziou writes: Again, these are strange and very limiting rules. What if I want to have 5 h 32 min? And 5,3 days? You provide a format string like you do now. That means if you want a format that's conditional on the

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

2012-11-06 Thread Toby Cubitt
On Tue, Nov 06, 2012 at 08:55:12PM +0100, Nicolas Goaziou wrote: Toby Cubitt ts...@cantab.net writes: I doubt it can be done now, since we already allow user-defined format strings. I'm more focused on what we will be able to do. Where are displayed durations formatted with

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

2012-11-06 Thread Achim Gratz
Toby Cubitt writes: On Tue, Nov 06, 2012 at 07:42:54PM +0100, Achim Gratz wrote: Nicolas Goaziou writes: Again, these are strange and very limiting rules. What if I want to have 5 h 32 min? And 5,3 days? You provide a format string like you do now. That means if you want a format that's

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

2012-11-05 Thread Nicolas Goaziou
Hello, Toby Cubitt ts...@cantab.net writes: Personally, I find the time duration 123:15 much harder to parse mentally than 5d 3:15. The attached patch adds a new customization option `org-time-clocksum-days-format'. When non-nil, this is used instead of `org-time-clocksum-format' for

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

2012-11-05 Thread Toby Cubitt
On Mon, Nov 05, 2012 at 10:14:27AM +0100, Nicolas Goaziou wrote: Toby Cubitt ts...@cantab.net writes: Personally, I find the time duration 123:15 much harder to parse mentally than 5d 3:15. The attached patch adds a new customization option `org-time-clocksum-days-format'. When

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

2012-11-05 Thread Achim Gratz
Nicolas Goaziou writes: As you suggest, I think a better plan is to replace all of them with a single `org-time-clocksum-display-function'. Its expected value would be a function accepting 2 arguments: hours and minutes, as numbers and it should return a string. Actually, it seems an even

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

2012-11-05 Thread Toby Cubitt
On Mon, Nov 05, 2012 at 11:47:12AM +0100, Achim Gratz wrote: Nicolas Goaziou writes: As you suggest, I think a better plan is to replace all of them with a single `org-time-clocksum-display-function'. Its expected value would be a function accepting 2 arguments: hours and minutes, as

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

2012-11-05 Thread Achim Gratz
Toby Cubitt writes: A format string isn't sufficient. It requires the number of time components (days, hours, minutes, etc.) to be fixed in advance. Whereas a function can decide whether to display e.g. days+hours or hours+minutes depending on whether the time is longer or shorter than 24h.

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

2012-11-05 Thread Toby Cubitt
On Mon, Nov 05, 2012 at 12:13:25PM +0100, Achim Gratz wrote: Toby Cubitt writes: A format string isn't sufficient. It requires the number of time components (days, hours, minutes, etc.) to be fixed in advance. Whereas a function can decide whether to display e.g. days+hours or hours+minutes

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

2012-11-05 Thread Nicolas Goaziou
Hello, Toby Cubitt ts...@cantab.net writes: Looking through the code, it seems the clocksum format options are used in two places: org-colview.el and org-clock.el. For some reason, only the latter honours `org-time-clocksum-use-fractional'. In my patch, only the former honoured the new

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

2012-11-05 Thread Toby Cubitt
On Mon, Nov 05, 2012 at 01:20:48PM +0100, Nicolas Goaziou wrote: Toby Cubitt ts...@cantab.net writes: [snip] [...] what about getting rid of every customization option except `org-time-clocksum-format', and parsing the format string itself to decide how many and what arguments to pass to

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

2012-11-05 Thread Nicolas Goaziou
Hello, Toby Cubitt ts...@cantab.net writes: I'd prefer to see some agreement before I waste time coding something that won't get accepted. Then let's wait for Achim (Cc'ed) to illustrate what he has in mind, because his proposal is too vague yet to permit discussion about it. Regards, --

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

2012-11-05 Thread Achim Gratz
Nicolas Goaziou writes: Then let's wait for Achim (Cc'ed) to illustrate what he has in mind, because his proposal is too vague yet to permit discussion about it. What I had in mind was to remove org-time-clocksum-format and replace the associated format calls with a formatting function that has

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

2012-11-05 Thread Toby Cubitt
On Mon, Nov 05, 2012 at 06:40:20PM +0100, Achim Gratz wrote: Nicolas Goaziou writes: Then let's wait for Achim (Cc'ed) to illustrate what he has in mind, because his proposal is too vague yet to permit discussion about it. What I had in mind was to remove org-time-clocksum-format and

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

2012-11-05 Thread Nicolas Goaziou
Toby Cubitt ts...@cantab.net writes: This is not far from your own suggestion to provide different functions depending on which output is desired, I just happen to think that these functions would all be so similar that they should be rolled into a single function that can produce different

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

2012-10-27 Thread Toby Cubitt
Personally, I find the time duration 123:15 much harder to parse mentally than 5d 3:15. The attached patch adds a new customization option `org-time-clocksum-days-format'. When non-nil, this is used instead of `org-time-clocksum-format' for clocksum durations longer than 1 day. It gets passed