On Sep 26, 2006, at 1:58, Russell Adams wrote:

I've gotten in a habit of storing my todo's in the following format,
and I'm curious if there's a way to automate this...

* Daily
** 2006-09
*** 2006-09-25
**** TODO Item One

I don't always have an item for each day, its sparsely populated, but
I'd like to automate making the first few headings.

Any suggestions? Even a macro? ;]

The cl macro "loop" is your friend....

(defun my-date-tree (y1 y2)
  (interactive "nFirst year: \nnLast year: ")
  (require 'calendar)
  (loop for y from y1 to y2 do
    (message "Doing year %d..." y)
    (insert "* " (format "%4d" y) "\n")
    (loop for m from 1 to 12 do
      (insert "** " (format "%4d-%02d" y m) "\n")
      (loop for d from 1 to 31 do
        (when (= m (car
                    (calendar-gregorian-from-absolute
                     (calendar-absolute-from-gregorian
                      (list m d y)))))
          (insert "*** " (format "%4d-%02d-%02d" y m d) "\n"))))))

Hope this helps

- Carsten



_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to