emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Wiegley <johnw@newartisans.com>
To: emacs-orgmode@gnu.org
Subject: Re: Autoarchiving done entries
Date: Mon, 03 Sep 2007 22:17:44 -0400	[thread overview]
Message-ID: <m2myw3fa2f.fsf@newartisans.com> (raw)
In-Reply-To: <200709040100.l8410JUE004132@localhost.localdomain> (Xavier Maillard's message of "Tue\, 4 Sep 2007 03\:00\:19 +0200")

Xavier Maillard <xma@gnu.org> writes:

>    >> I use something that I thought your users might find handy.  It causes
>    >> all completed todo items to be automatically flushed to the archive
>    >> whenever I save my todo file.
>    How about having it auto-archive completed TODOs that were finished more
>    than a configurable number of days ago? I'd find that pretty useful.
> Sounds like the expiration mechanism one can find into gnus. I like the
> idea.

Quite a nice idea.  In fact... DONE.


(defvar org-my-archive-expiry-days 2
  "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 ()
    (goto-char (point-min))
    (let ((done-regexp
	   (concat "\\* \\(" (regexp-opt org-done-keywords) "\\) "))
	   (concat "- State \"\\(" (regexp-opt org-done-keywords)
      (while (re-search-forward done-regexp nil t)
	(let ((end (save-excursion
	  (goto-char (line-beginning-position))
	  (setq begin (point))
	  (when (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)))

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

  reply	other threads:[~2007-09-04  2:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-02  7:30 Autoarchiving done entries Carsten Dominik
2007-09-03  1:00 ` Xavier Maillard
2007-09-03  2:27 ` David Emery
2007-09-04  1:00   ` Xavier Maillard
2007-09-04  2:17     ` John Wiegley [this message]
2007-09-04  7:02       ` Xavier Maillard
2007-09-05  3:42         ` Carsten Dominik
2007-09-03  3:12 ` John Wiegley

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:

  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=m2myw3fa2f.fsf@newartisans.com \
    --to=johnw@newartisans.com \
    --cc=emacs-orgmode@gnu.org \


* 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


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).