emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Toby Cubitt <tsc25@cantab.net>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Separate clocksum format for durations >= 1 day
Date: Mon, 5 Nov 2012 13:10:58 +0100	[thread overview]
Message-ID: <20121105121058.GA21634@c3po> (raw)
In-Reply-To: <874nl4xpyi.fsf@Rainer.invalid>

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

  reply	other threads:[~2012-11-05 12:10 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-27 14:01 [PATCH] Separate clocksum format for durations >= 1 day Toby Cubitt
2012-11-05  9:14 ` Nicolas Goaziou
2012-11-05 10:25   ` Toby Cubitt
2012-11-05 10:47   ` Achim Gratz
2012-11-05 11:01     ` Toby Cubitt
2012-11-05 11:13       ` Achim Gratz
2012-11-05 12:10         ` Toby Cubitt [this message]
2012-11-05 12:20           ` Nicolas Goaziou
2012-11-05 12:55             ` Toby Cubitt
2012-11-05 13:14               ` Nicolas Goaziou
2012-11-05 17:40                 ` Achim Gratz
2012-11-05 18:16                   ` Toby Cubitt
2012-11-05 22:45                     ` Nicolas Goaziou
2012-11-06 10:35                       ` Toby Cubitt
2012-11-06 10:57                         ` Nicolas Goaziou
2012-11-06 12:01                           ` Toby Cubitt
2012-11-06 12:29                             ` Nicolas Goaziou
2012-11-06 13:04                               ` Toby Cubitt
2012-11-06 17:41                                 ` Nicolas Goaziou
2012-11-06 19:26                                   ` Toby Cubitt
2012-11-06 19:55                                     ` Nicolas Goaziou
2012-11-06 20:35                                       ` Toby Cubitt
2012-11-08  0:26                                         ` Nicolas Goaziou
2012-11-08 11:28                                           ` Toby Cubitt
2012-11-09  8:04                                             ` Nicolas Goaziou
2012-11-13 13:03                                               ` Toby Cubitt
2012-11-14 15:04                                                 ` Nicolas Goaziou
2012-11-14 15:37                                                   ` Toby Cubitt
2012-11-14 16:09                                                     ` Nicolas Goaziou
2012-11-14 16:20                                                       ` Toby Cubitt
2012-11-16 15:12                                                         ` Toby Cubitt
2012-11-17  8:48                                                           ` Nicolas Goaziou
2012-11-17 14:00                                                             ` Toby Cubitt
2012-11-17 14:42                                                               ` Nicolas Goaziou
2012-11-17 16:02                                                                 ` Toby Cubitt
2012-11-20 16:12                                                                   ` Mike McLean
2012-11-20 17:28                                                                     ` Toby Cubitt
2012-11-20 19:24                                                                       ` Nicolas Goaziou
2012-11-21 23:29                                                                         ` Mike McLean
2012-11-30 11:22                                                                 ` [bug] " Sebastien Vauban
2012-11-06 18:42                       ` [PATCH] " Achim Gratz
2012-11-06 20:10                         ` Toby Cubitt
2012-11-06 20:49                           ` Achim Gratz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121105121058.GA21634@c3po \
    --to=tsc25@cantab.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=toby-dated-1353327040.bec99e@dr-qubit.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).