From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Halder Subject: Re: org table calc and lisp for hh:mm timetable Date: Thu, 24 Mar 2011 19:35:38 +0100 Message-ID: References: <9999237C-1FBD-481E-AF8D-D68DB85080CE@gmail.com> <87lj0gqjd3.fsf@ucl.ac.uk> <0DDD90AF-9B9A-4FE3-8080-74EF01E6E292@gmail.com> <4D7FDE8C.1030103@christianmoe.com> <00BD91C6-C610-4CDD-B3E0-E9FECDAA372C@gmail.com> <87k4fynog3.fsf@altern.org> <87lj09llzd.fsf@gmail.com> <4D866AD7.4020701@christianmoe.com> <87fwqhl5mu.fsf@gmail.com> <87mxknhioh.fsf@gmail.com> <4D886D8B.10401@christianmoe.com> <87wrjpiado.fsf@gmail.com> Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=45797 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q2pNq-0008F2-PM for emacs-orgmode@gnu.org; Thu, 24 Mar 2011 14:35:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q2pNp-00055A-Lz for emacs-orgmode@gnu.org; Thu, 24 Mar 2011 14:35:46 -0400 Received: from mail-ew0-f41.google.com ([209.85.215.41]:38444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q2pNp-000556-GZ for emacs-orgmode@gnu.org; Thu, 24 Mar 2011 14:35:45 -0400 Received: by ewy9 with SMTP id 9so221123ewy.0 for ; Thu, 24 Mar 2011 11:35:44 -0700 (PDT) In-Reply-To: <87wrjpiado.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: Bastien , emacs-orgmode@gnu.org, mail@christianmoe.com >> If we're not just looking for a neat workaround for some special = cases=20 >> anymore, but looking at making org-tables aware of time-like strings=20= >> by default, a better strategy than to convert them into integers = might=20 >> be to translate them into Calc time format and back again. >>=20 >> After all, Calc and hence the Org spreadsheet already handles time=20 >> arithmetic perfectly well, it's just that it would be nice to have=20 >> this functionality with the extra option to enter and display times = as=20 >> =3D12:45=3D rather than =3D12@ 45'=3D or =3D12h 45m=3D. >>=20 >=20 > I did not realize that calc (and hence Org) already supported = operating > on time values. The =3D7@ 30'=3D format does indeed work well for = time > table formulas (although the =3D12h 5m=3D format does not), e.g., >=20 > | 1@ 20' | 2 | 0@ 40' 0." | > | 2@ 5' | 3 | 0@ 41' 40." | > #+TBLFM: $3=3D$1/$2 >=20 > Maybe all that is needed is explicit mention of this syntax somewhere = in > the table section of the Org-mode manual. >=20 > 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. >=20 > However as Carsten mentioned such an automatic translation of e.g., > =3D7:20=3D to =3D7@ 20'=3D would be a bit bold, and (as mentioned = elsewhere) it > would result in having to make some denomination decisions, namely = does > =3D7:20=3D convert to =3D7@ 20'=3D or =3D7' 20"=3D. >=20 > For now I've posted my `with-time' macro up to Worg. >=20 > 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=3D'(with-time t (+ @2..@>>)) Thanks a lot (also for making it to org hacks : ) Martin