From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: Date-centric Clocktable Date: Thu, 08 Sep 2011 01:38:49 +0200 Message-ID: <87obyvncs6.fsf@gmail.com> References: <87zkip7oc6.fsf@gmail.com> <87mxegenfh.fsf@rat.lan> <87d3fcsoqf.fsf@gmail.com> <871uvsejxp.fsf@rat.lan> <87sjo8cw0v.fsf@rat.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:51898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1Rg2-0000gY-NC for emacs-orgmode@gnu.org; Wed, 07 Sep 2011 19:37:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R1Rg1-00081n-RA for emacs-orgmode@gnu.org; Wed, 07 Sep 2011 19:37:06 -0400 Received: from lo.gmane.org ([80.91.229.12]:41398) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1Rg1-00081d-Gj for emacs-orgmode@gnu.org; Wed, 07 Sep 2011 19:37:05 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1R1Rfy-0003CD-Qd for emacs-orgmode@gnu.org; Thu, 08 Sep 2011 01:37:02 +0200 Received: from 0x555293e1.adsl.cybercity.dk ([85.82.147.225]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 08 Sep 2011 01:37:02 +0200 Received: from rasmus by 0x555293e1.adsl.cybercity.dk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 08 Sep 2011 01:37:02 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org > ---8<--- cut here --- > (defun collect-clock-lines () > (let ((re (concat "^[ \t]*" org-clock-string "[ \t]+\\(.+?\\)[ \t]+=>[ \t]+\\(.+\\)")) > (headline (nth 4 (org-heading-components))) > clocks) > (org-narrow-to-subtree) > (while (re-search-forward re nil t) > (setq clocks (concat clocks (format "| %s | %s | %s |\n" (match-string 1) headline (match-string 2))))) > (widen) > clocks)) > > (defun summarize-clocks () > (interactive) > (insert "| date | headline | total |\n|-----+----+----|\n") > (let ((headings (org-map-entries 'collect-clock-lines nil 'file))) > (mapc (lambda (clocks) > (mapc (lambda (line) (insert line)) clocks)) > headings))) > --- cut here --->8--- > > This version works a little bit better, but has its own drawbacks. > Anyway, it's a start and I don't want to take all the fun away. ;-) I think I found one of the drawbacks :) #+begin_src org * COMMENT Organization Headline ** Collecting data :LOGBOOK: CLOCK: [2011-09-08 Thu 00:31]--[2011-09-08 Thu 00:59] => 0:28 :END: * Clocktable :LOGBOOK: CLOCK: [2011-09-08 Thu 01:30]--[2011-09-08 Thu 01:37] => 0:07 :END: Note that subitems are counted twice: | date | headline | total | |------------------------------------------------+-------------------------------+-------| | [2011-09-08 Thu 00:31]--[2011-09-08 Thu 00:59] | COMMENT Organization Headline | 0:28 | | [2011-09-08 Thu 00:31]--[2011-09-08 Thu 00:59] | Collecting data | 0:28 | | [2011-09-08 Thu 01:30]--[2011-09-08 Thu 01:37] | Clocktable | 0:07 | #+end_src I might look into it later. –Rasmus -- Sent from my Emacs