emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Martin Halder <martin.halder@gmail.com>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: Bastien <bzg@altern.org>, emacs-orgmode@gnu.org, mail@christianmoe.com
Subject: Re: org table calc and lisp for hh:mm timetable
Date: Thu, 24 Mar 2011 19:35:38 +0100	[thread overview]
Message-ID: <B0725731-199B-4154-8AD3-99B362846632@gmail.com> (raw)
In-Reply-To: <87wrjpiado.fsf@gmail.com>

>> If we're not just looking for a neat workaround for some special cases 
>> anymore, but looking at making org-tables aware of time-like strings 
>> by default, a better strategy than to convert them into integers might 
>> be to translate them into Calc time format and back again.
>> 
>> After all, Calc and hence the Org spreadsheet already handles time 
>> arithmetic perfectly well, it's just that it would be nice to have 
>> this functionality with the extra option to enter and display times as 
>> =12:45= rather than =12@ 45'= or =12h 45m=.
>> 
> 
> I did not realize that calc (and hence Org) already supported operating
> on time values.  The =7@ 30'= format does indeed work well for time
> table formulas (although the =12h 5m= format does not), e.g.,
> 
> | 1@ 20' | 2 | 0@ 40' 0."  |
> | 2@ 5'  | 3 | 0@ 41' 40." |
> #+TBLFM: $3=$1/$2
> 
> Maybe all that is needed is explicit mention of this syntax somewhere in
> the table section of the Org-mode manual.
> 
> The only remaining reason to support a %d:%d time format is that it is
> what I (and I expect most users) would first think of to represent time,
> and supporting such a format would allow time calculation in a table to
> "just work" -- meaning users could likely manipulate time without having
> to first look in the manual for the appropriate Calc format.
> 
> However as Carsten mentioned such an automatic translation of e.g.,
> =7:20= to =7@ 20'= would be a bit bold, and (as mentioned elsewhere) it
> would result in having to make some denomination decisions, namely does
> =7:20= convert to =7@ 20'= or =7' 20"=.
> 
> For now I've posted my `with-time' macro up to Worg.
> 
> Cheers -- Eric

Hi all,

just came back on this thread and was amazed what you guys did with it.. amazing.. havent tried the patch yet but the with-time macro is great. Now it is even easy to sum up a whole column of timevalues.

I use it like the following now:

| start | lunch |  back | leave |   sum |
|-------+-------+-------+-------+-------|
|  8:00 | 12:00 | 13:00 | 17:00 |  8:00 |
|  8:00 | 12:00 | 13:00 | 17:00 |  8:00 |
|-------+-------+-------+-------+-------|
|       |       |       |       | 16:00 |
#+TBLFM: @>$5='(with-time t (+ @2..@>>))

Thanks a lot (also for making it to org hacks : )
Martin

  reply	other threads:[~2011-03-24 18:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-15 18:32 org table calc and lisp for hh:mm timetable Martin Halder
2011-03-15 19:22 ` Eric S Fraga
2011-03-15 19:49   ` Martin Halder
2011-03-15 20:37     ` Eric S Fraga
2011-03-15 21:47     ` Christian Moe
2011-03-16  9:22       ` Martin Halder
2011-03-17  7:49         ` Bastien
2011-03-20 17:50           ` Eric Schulte
2011-03-20 19:57             ` Eric S Fraga
2011-03-20 17:50           ` Eric Schulte
2011-03-20 21:00             ` Christian Moe
2011-03-20 23:43               ` Eric Schulte
2011-03-22  4:40                 ` Eric Schulte
2011-03-22  9:36                   ` Christian Moe
2011-03-24  1:18                     ` Eric Schulte
2011-03-24 18:35                       ` Martin Halder [this message]
2011-03-22 10:52                   ` Carsten Dominik
2011-07-02 11:38                     ` Bastien
2011-03-16  9:28       ` Eric S Fraga

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=B0725731-199B-4154-8AD3-99B362846632@gmail.com \
    --to=martin.halder@gmail.com \
    --cc=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@christianmoe.com \
    --cc=schulte.eric@gmail.com \
    /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).