From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Wiegley Subject: Tip: Interleaving notes and todos Date: Sun, 07 Oct 2007 05:59:00 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IeSui-0002cS-PM for emacs-orgmode@gnu.org; Sun, 07 Oct 2007 05:59:08 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IeSuh-0002c9-CI for emacs-orgmode@gnu.org; Sun, 07 Oct 2007 05:59:08 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IeSuh-0002c1-9i for emacs-orgmode@gnu.org; Sun, 07 Oct 2007 05:59:07 -0400 Received: from johnwiegley.com ([208.70.150.153] helo=mail.johnwiegley.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IeSug-0003eW-Ro for emacs-orgmode@gnu.org; Sun, 07 Oct 2007 05:59:07 -0400 Received: from Hermes.local (unknown [72.22.154.84]) by mail.johnwiegley.com (Postfix) with ESMTP id 01ABD4224CD for ; Sun, 7 Oct 2007 04:59:05 -0500 (CDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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)