From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Dietsche Subject: Re: Date-centric Clocktable Date: Wed, 07 Sep 2011 15:38:40 +0200 Message-ID: <87sjo8cw0v.fsf@rat.lan> References: <87zkip7oc6.fsf@gmail.com> <87mxegenfh.fsf@rat.lan> <87d3fcsoqf.fsf@gmail.com> <871uvsejxp.fsf@rat.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([140.186.70.92]:58277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1IL6-0006vw-4i for emacs-orgmode@gnu.org; Wed, 07 Sep 2011 09:38:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R1IL1-0006cF-RG for emacs-orgmode@gnu.org; Wed, 07 Sep 2011 09:38:52 -0400 Received: from www85.your-server.de ([213.133.104.85]:52146) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R1IL1-0006c5-KW for emacs-orgmode@gnu.org; Wed, 07 Sep 2011 09:38:47 -0400 In-Reply-To: <871uvsejxp.fsf@rat.lan> (Olaf Dietsche's message of "Wed, 07 Sep 2011 12:16:50 +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: Rasmus Cc: emacs-orgmode@gnu.org Olaf Dietsche writes: > Rasmus writes: > >> 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 --- [buggy code] > --- cut here --->8--- I finally came around and tested the code, but unfortunately it doesn't work as expected. Here is another version: ---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. ;-) Regards, Olaf