emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] monthly report


From: Carsten Dominik
Subject: Re: [Orgmode] monthly report
Date: Tue, 29 May 2007 14:29:11 +0200


On May 25, 2007, at 3:41, Steven Lumos wrote:

Being yet another planner switcher, I'm used to using planner-report-
generate to assist me with writing a monthly activity report.  I don't
need fine-grained time tracking, or even most of what planner-report-
generate does--it would be ideal to get just a list of TODOs that were
closed between two dates and then I'll look at it while I type a few
sentences in an email buffer.

Is there already an easy way to "get a list" (I guess that a sparse
tree would be most convenient for me) of TODOs marked as closed within
some date range?

You can use org-occur to create a tree with matches of CLOSED time stamps.
And you can use the callback argument of org-occur to verify if a
match is in a given time interval.  Something like this:

(defun org-closed-in-range ()
  "Sparse treee of items closed in a certain time range."
  (interactive)
  ;; Get the time interval from the user.
  (let* ((time1 (time-to-seconds
                 (org-read-date nil 'to-time nil "Starting date: ")))
         (time2 (time-to-seconds
                 (org-read-date nil 'to-time nil "End date:")))
         ;; callbakc function
         (callback (lambda ()
                     (let ((time
                            (time-to-seconds
                             (apply 'encode-time
                                    (org-parse-time-string
                                     (match-string 1))))))
                       ;; check if time in interval
                       (and (>= time time1) (<= time time2))))))
    ;; make tree, check each match with the callback
    (org-occur "CLOSED: +\\[\\(.*?\\)\\]" nil callback)))





reply via email to

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