* Tip: Interleaving notes and todos
@ 2007-10-07 9:59 John Wiegley
0 siblings, 0 replies; only message in thread
From: John Wiegley @ 2007-10-07 9:59 UTC (permalink / raw)
To: emacs-orgmode
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)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-10-07 9:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-07 9:59 Tip: Interleaving notes and todos John Wiegley
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).