From: John Wiegley <johnw@newartisans.com>
To: emacs-orgmode@gnu.org
Subject: Tip: Interleaving notes and todos
Date: Sun, 07 Oct 2007 05:59:00 -0400 [thread overview]
Message-ID: <m21wc7dz4r.fsf@newartisans.com> (raw)
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)
reply other threads:[~2007-10-07 9:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m21wc7dz4r.fsf@newartisans.com \
--to=johnw@newartisans.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).