From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Dietsche Subject: Re: Date-centric Clocktable Date: Wed, 07 Sep 2011 12:16:50 +0200 Message-ID: <871uvsejxp.fsf@rat.lan> References: <87zkip7oc6.fsf@gmail.com> <87mxegenfh.fsf@rat.lan> <87d3fcsoqf.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([140.186.70.92]:56249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1FBr-0000ZT-76 for emacs-orgmode@gnu.org; Wed, 07 Sep 2011 06:17:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R1FBm-0003h5-7A for emacs-orgmode@gnu.org; Wed, 07 Sep 2011 06:17:07 -0400 Received: from www85.your-server.de ([213.133.104.85]:58395) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1FBm-0003g8-2Z for emacs-orgmode@gnu.org; Wed, 07 Sep 2011 06:17:02 -0400 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: Rasmus Cc: emacs-orgmode@gnu.org Rasmus writes: >> Why don't you just use a simple (perl/python/...) script to collect your >> data? Here's a quick hack in perl: > > That was my plan if I was not able to do from within Org. To me it would > be a lot faster than hacking something together in emacs-lisp, > unfortunately. If you insist on elisp, maybe something along these (untested) lines might work: ---8<--- cut here --- (defvar clockstable) (defun collect-clock-lines () (org-narrow-to-subtree) (let ((re (concat "^[ \t]*" org-clock-string "[ \t]+\\(.+?\\)[ \t]+=>[ \t]+\\(.+\\)")) (headline (nth 4 (org-heading-components)))) (while (re-search-forward re) (setq clockstable (concat clockstable (match-string 1) "|" headline "|" (match-string 2) "\n"))))) (defun summarize-clocks () (interactive) (setq clockstable "| date | headline | total |\n|-----+----+----|\n") (org-map-entries collect-clock-lines nil 'agenda) (insert clockstable)) --- cut here --->8--- Regards, Olaf