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 outputs. I think there'd >> only be a handful of possible values for fmt based on the current usage >> and that suggests just another cond form would be needed in >> implementing this function rather than a full-blown format string >> interpreter. > > It seems to me your `org--format-time' function would end up looking very > like what I sketched. A cond to switch between "hh:mm", "hh.mm", > "dd hh:mm" or "dd hh.mm" based only on the contents of the fmt argument > would have to check whether fmt contains 2 or 3 %-sequences, then check > if it contains "." or ":"
Again, these are strange and very limiting rules. What if I want to have "5 h 32 min"? And "5,3 days"? Achim didn't specify how he conceives the FMT argument. One possibility would be to have a placeholder-based template with, i.e. %d, %h, %m, %w for respectively number of days, hours, minutes and weeks. But it's still less flexible than functions because you need to have a fixed number of placeholders in every template. 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 user-defined function. Regards, -- Nicolas Goaziou