[Top][All Lists]

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

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

From: Toby Cubitt
Subject: Re: [O] [PATCH] Separate clocksum format for durations >= 1 day
Date: Tue, 6 Nov 2012 14:04:01 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Nov 06, 2012 at 01:29:02PM +0100, Nicolas Goaziou wrote:
> Toby Cubitt <address@hidden> 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.


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.

Dr T. S. Cubitt
Mathematics and Quantum Information group
Department of Mathematics
Complutense University
Madrid, Spain

email: address@hidden
web:   www.dr-qubit.org

reply via email to

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