From mboxrd@z Thu Jan 1 00:00:00 1970 From: Toby Cubitt Subject: Re: [PATCH] Separate clocksum format for durations >= 1 day Date: Tue, 6 Nov 2012 14:04:01 +0100 Message-ID: <20121106130401.GA10697@c3po> References: <871ug6ap9t.fsf@gmail.com> 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]:42453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TVios-0001dp-4B for emacs-orgmode@gnu.org; Tue, 06 Nov 2012 08:03:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TVioi-00039f-Cm for emacs-orgmode@gnu.org; Tue, 06 Nov 2012 08:03:54 -0500 Received: from starfish.geekisp.com ([216.168.135.166]:39751) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1TVioi-000390-8L for emacs-orgmode@gnu.org; Tue, 06 Nov 2012 08:03:44 -0500 Content-Disposition: inline In-Reply-To: <871ug6ap9t.fsf@gmail.com> 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 Tue, Nov 06, 2012 at 01:29:02PM +0100, Nicolas Goaziou wrote: > Toby Cubitt 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 > functions instead of format strings to customize output. Because customizing a format string is easier than defining a new function when you don't want to do anything more fancy than modifying the textual formatting. (If you want to do something conditional on the duration, then defining a new function is natural.) > > You still need a way to allow users to supply format strings, so they can > > customize the appearance of the `regular' and `decimal' formats. Your own > > "5 h 32 min" and "5,3 days" examples demonstrate this. > > In my proposal, customizing `regular' and `decimal' format wasn't > expected. > > > This either implies a second defcustom for the format strings, or it > > implies storing both the format strings and choice of function choice in > > the same defcustom. Furthermore, one format string isn't be enough > > because you might want to different numbers of placeholders depending on > > the duration (which is what my original patch allowed). > > But let's forget about it, it's a false good idea, anyway. I'm shooting > myself in the foot: custom formats mean parsing hell. No. It's possible to do it with standard format strings. You just need to (optionally) allow multiple format strings, one for each duration. > So either: > > 1. We define a new format, non customizable, but possibly conditional, > which can describe a duration, in order to include days. > > 2. We allow customization as overlays (much like timestamps). > > 3. We leave it as-is. > > I'm not very fond of 2, so I think this whole customization problem is > moot anyway. Or 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 format required, no format string parsing required. Best, 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