all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: Date-centric Clocktable
Date: Thu, 08 Sep 2011 01:38:49 +0200	[thread overview]
Message-ID: <87obyvncs6.fsf@gmail.com> (raw)
In-Reply-To: 87sjo8cw0v.fsf@rat.lan

> ---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

  reply	other threads:[~2011-09-07 23:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-31 12:33 Date-centric Clocktable Rasmus
2011-09-06 10:36 ` Bernt Hansen
2011-09-06 21:36   ` Rasmus
2011-09-06 21:47     ` Carsten Dominik
2011-09-07  8:07       ` Rasmus
2011-09-07  8:16         ` Carsten Dominik
2011-09-07 12:54           ` Giovanni Ridolfi
2011-09-07  2:08     ` Bernt Hansen
2011-09-07  8:11       ` Rasmus
2011-09-07  9:01 ` Olaf Dietsche
2011-09-07  9:09   ` Rasmus
2011-09-07 10:16     ` Olaf Dietsche
2011-09-07 10:28       ` Carsten Dominik
2011-09-07 13:54         ` Olaf Dietsche
2011-09-07 22:53           ` Rasmus
2011-09-08 13:40             ` A. Ryan Reynolds
2011-09-07 10:56       ` Rasmus
2011-09-07 11:30         ` Olaf Dietsche
2011-09-07 13:38       ` Olaf Dietsche
2011-09-07 23:38         ` Rasmus [this message]
2011-10-21 17:52 ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87obyvncs6.fsf@gmail.com \
    --to=rasmus@gmx.us \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.