emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Date-centric Clocktable


From: Olaf Dietsche
Subject: Re: [O] Date-centric Clocktable
Date: Wed, 07 Sep 2011 12:16:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Rasmus <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]