Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: John Wiegley <johnw <at> newartisans.com>
Subject: Tip: Interleaving notes and todos
Newsgroups: gmane.emacs.orgmode
Date: Sunday 7th October 2007 09:59:00 UTC (over 9 years ago)
I've recently found it very happen to start adding non-task "notes" into
the
flow of my todos.

What I do is make notes look like completed todos.  They get entered into
the
regular flow, which prompts me either to a) generate a task from them, or
b)
simply file them into their related category.  Since they are implicit in a
"complete" state, I have org-mode automatically archive them into my todo
archive after a certain number of days.

I set apart the coloring of notes from todo by using the "NOTE" todo state,
and the following face values (note, these assume a white background):

 (setq org-todo-keyword-faces
       (quote (("TODO" :foreground "medium blue" :weight bold)
               ("APPT" :foreground "medium blue" :weight bold)
               ("NOTE" :foreground "dark violet" :weight bold)
               ("STARTED" :foreground "dark orange" :weight bold)
               ("WAITING" :foreground "red" :weight bold)
               ("DELEGATED" :foreground "red" :weight bold))))

This is paired with the following at the top of my org-mode file:

  MY TASKS  -*- mode: org; fill-column: 78; after-save-hook:
(archive-done-tasks) -*-

  #+SEQ_TODO: TODO STARTED WAITING DELEGATED APPT | DONE DEFERRED CANCELLED
NOTE
  #+ARCHIVE: archive.txt::

If you're looking for the code behind `archive-done-tasks', just add the
code following this post to your .emacs file.

John

(defvar org-my-archive-expiry-days 7
  "The number of days after which a completed task should be auto-archived.
This can be 0 for immediate, or a floating point value.")

(defun org-my-archive-done-tasks ()
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (let ((done-regexp
           (concat "\\* \\(" (regexp-opt org-done-keywords) "\\) "))
          (state-regexp
           (concat "- State \"\\(" (regexp-opt org-done-keywords)
                   "\\)\"\\s-*\\[\\([^]\n]+\\)\\]")))
      (while (re-search-forward done-regexp nil t)
        (let ((end (save-excursion
                     (outline-next-heading)
                     (point)))
              begin)
          (goto-char (line-beginning-position))
          (setq begin (point))
          (if (re-search-forward state-regexp end t)
              (let* ((time-string (match-string 2))
                     (when-closed (org-parse-time-string time-string)))
                (if (>= (time-to-number-of-days
                         (time-subtract (current-time)
                                        (apply #'encode-time when-closed)))
                        org-my-archive-expiry-days)
                    (org-archive-subtree)))
            (goto-char end)))))
    (save-buffer)))

(setq safe-local-variable-values (quote ((after-save-hook
archive-done-tasks))))

(defalias 'archive-done-tasks 'org-my-archive-done-tasks)


_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
 
CD: 3ms