From mboxrd@z Thu Jan 1 00:00:00 1970 From: Toby Cubitt Subject: Re: [PATCH] Separate clocksum format for durations >= 1 day Date: Mon, 5 Nov 2012 13:10:58 +0100 Message-ID: <20121105121058.GA21634@c3po> References: <874nl4xpyi.fsf@Rainer.invalid> Reply-To: Toby Cubitt Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([208.118.235.92]:45978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TVLVv-0003dL-1C for emacs-orgmode@gnu.org; Mon, 05 Nov 2012 07:10:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TVLVp-0005kv-M2 for emacs-orgmode@gnu.org; Mon, 05 Nov 2012 07:10:46 -0500 Received: from starfish.geekisp.com ([216.168.135.166]:15970) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1TVLVp-0005kd-HR for emacs-orgmode@gnu.org; Mon, 05 Nov 2012 07:10:41 -0500 Content-Disposition: inline In-Reply-To: <874nl4xpyi.fsf@Rainer.invalid> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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 > > depending on whether the time is longer or shorter than 24h. > > You can define the format specification with any semantics you want, > including alternatives like those suggested above. OK, I get it now. I was interpreting "format specification" to mean format string, but that's not what you meant. > > A defcustom that can either be a format string *or* a function might be > > an option. > > What I'm saying is that this whole business of exposing formatting > functions to the user is somewhat superfluous. But defining a custom format semantics just for this one rather simple case also seems somewhat superfluous. We already have a clean, well-known, well-understood semantics for expressing conditionals: Elisp. I'm not sure we've hit upon the clean solution yet... 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 `org-time-clocksum-days-format'. Some rationalisation of all these options is clearly needed. Most users are probably happy with the defaults. So the question is how best to allow the small minority who want to tweak the clocksum format to do so. A couple of questions: 1. Is there any real need to allow the org-colview and org-clock formats to be customized independently? Making them the same would simplify things and probably be clearer for users. 2. What are the different formats that users are likely to want? The list can't be very long. I can think of: "hh:mm", "hh.mm" (fractional), "dd hh:mm" (separate days), "dd hh.mm", and possibly "MM dd hh:mm" and "YY MM dd hh:mm". If the above covers everything we want, then 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 it? More precisely, if the format string contains ":", "." or "," then the smallest time component is minutes; otherwise it's hours. Pass as many time components as necessary to fill all the "%" expandos in the format string, from largest to smallest, with either hours or minutes as the smallest. If the format string contains "." or "," then pass the number of minutes as a fraction ("," is used as the decimal separator in many European languages). This would simplify things, and make the format string just "do the right thing" in all the cases I listed above. On the other hand, it won't allow unusual formats that don't fit the above scheme (but they're not possible now, anyway). Thoughts? Toby -- Dr T. S. Cubitt Mathematics and Quantum Information group Department of Mathematics Complutense University Madrid, Spain email: tsc25@cantab.net web: www.dr-qubit.org