From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Halder Subject: org table calc and lisp for hh:mm timetable Date: Tue, 15 Mar 2011 19:32:24 +0100 Message-ID: <9999237C-1FBD-481E-AF8D-D68DB85080CE@gmail.com> Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=55944 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzZ2k-0000CA-QI for emacs-orgmode@gnu.org; Tue, 15 Mar 2011 14:32:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PzZ2j-0004Sl-IT for emacs-orgmode@gnu.org; Tue, 15 Mar 2011 14:32:30 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:44444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PzZ2j-0004SQ-D8 for emacs-orgmode@gnu.org; Tue, 15 Mar 2011 14:32:29 -0400 Received: by wwc33 with SMTP id 33so918472wwc.30 for ; Tue, 15 Mar 2011 11:32:28 -0700 (PDT) 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: emacs-orgmode@gnu.org Hi all, some words of warning: this was written by an Emacs, Org, Lisp and Calc = newbie.. and congratulations on converting a vim user btw, org mode is = great : ) I was trying to generate a simple table with time format "hh:mm" and = auto calculate daily sum.. clocking working time was too much so I = thought this would be easy but ended up with the following.. it works = but is not beautiful (apply formula twice and same information multiple = times) and I would like to get rid of the "hms", "hh" and "mm" columns = and therefore call "hmconcat" directly somehow.. Any help is highly = appreciated..=20 Thanks, Martin | Date | Start | Lunch | Back | End | Sum | hms | = hh | mm | = |------------------+-------+-------+-------+-------+-------+-----------+--= --+----| | [2011-03-01 Tue] | 08:00 | 12:20 | 13:00 | 17:00 | 08:20 | 8@ 20' 0" | = 8 | 20 | #+TBLFM: $6=3D'(hmconcat $8 $9)::$7=3Dtime(<2010-01-01 = $5>)-time(<2010-01-01 $4>)+time(<2010-01-01 $3>)-time(<2010-01-01 = $2>)::$8=3Dhour($7)::$9=3Dminute($7) (defun hmconcat (hh mm) (interactive) (if (> (length hh) 1) (setq temp (concat hh ":")) (setq temp (concat "0" hh ":"))) (if (> (length mm) 1) (concat temp mm) (concat temp "0" mm)))=