emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Autoarchiving done entries
@ 2007-09-02  7:30 Carsten Dominik
  2007-09-03  1:00 ` Xavier Maillard
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Carsten Dominik @ 2007-09-02  7:30 UTC (permalink / raw)
  To: org-mode mailing list


I got his message from John a few days ago - might be useful for
some.  And since I have not yet decided if and how I am going to
include it, help yourself, for now.

(message has been slightly edited by CD)

Begin forwarded message:

> From: John Wiegley <johnw@newartisans.com>
> Date: August 31, 2007 5:04:49 CEST


> 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.
>
> It consists of these settings:
>
>   (setq safe-local-variable-values (quote ((after-save-hook 
> archive-done-tasks))))
>
>   (defun org-my-archive-done-tasks ()
>     (interactive)
>     (save-excursion
>       (goto-char (point-min))
>       (while (re-search-forward
>      	        (concat "\\* " (regexp-opt org-done-keywords) " ") nil t)
>         (goto-char (line-beginning-position))
>         (org-archive-subtree))))
>
>   (defalias 'archive-done-tasks 'org-my-archive-done-tasks)
>
> After setting these, I add the following to the top of my todo file:
>
>   MY TASKS  -*- mode: org; fill-column: 78; after-save-hook: 
> (archive-done-tasks) -*-
>
> John
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Autoarchiving done entries
  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-03  3:12 ` John Wiegley
  2 siblings, 0 replies; 8+ messages in thread
From: Xavier Maillard @ 2007-09-03  1:00 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode



   I got his message from John a few days ago - might be useful for
   some.  And since I have not yet decided if and how I am going to
   include it, help yourself, for now.

I like the idea, considering that my main org files is full of
hundreds of todo items, notes, meetings, etc... Having
auto-archive for this org file would be of great help for me.

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Autoarchiving done entries
  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-03  3:12 ` John Wiegley
  2 siblings, 1 reply; 8+ messages in thread
From: David Emery @ 2007-09-03  2:27 UTC (permalink / raw)
  To: org-mode mailing list

Carsten Dominik <dominik@science.uva.nl> writes:

> I got his message from John a few days ago - might be useful for
> some.  And since I have not yet decided if and how I am going to
> include it, help yourself, for now.
>
> Begin forwarded message:
>
>> 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.

//Dave

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Autoarchiving done entries
  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-03  3:12 ` John Wiegley
  2 siblings, 0 replies; 8+ messages in thread
From: John Wiegley @ 2007-09-03  3:12 UTC (permalink / raw)
  To: emacs-orgmode

John Wiegley <johnw@gnu.org> wort:

>>   (concat "\\* " (regexp-opt org-done-keywords) " ") nil t)

This part here should read instead:

   (concat "\\* \\(" (regexp-opt org-done-keywords) "\\) ") nil t)

John

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Autoarchiving done entries
  2007-09-03  2:27 ` David Emery
@ 2007-09-04  1:00   ` Xavier Maillard
  2007-09-04  2:17     ` John Wiegley
  0 siblings, 1 reply; 8+ messages in thread
From: Xavier Maillard @ 2007-09-04  1:00 UTC (permalink / raw)
  To: David Emery; +Cc: emacs-orgmode


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

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Autoarchiving done entries
  2007-09-04  1:00   ` Xavier Maillard
@ 2007-09-04  2:17     ` John Wiegley
  2007-09-04  7:02       ` Xavier Maillard
  0 siblings, 1 reply; 8+ messages in thread
From: John Wiegley @ 2007-09-04  2:17 UTC (permalink / raw)
  To: emacs-orgmode

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.

John

(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 ()
  (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))
	  (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)))
		      org-my-archive-expiry-days)
		  (org-archive-subtree)))))))))

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Autoarchiving done entries
  2007-09-04  2:17     ` John Wiegley
@ 2007-09-04  7:02       ` Xavier Maillard
  2007-09-05  3:42         ` Carsten Dominik
  0 siblings, 1 reply; 8+ messages in thread
From: Xavier Maillard @ 2007-09-04  7:02 UTC (permalink / raw)
  To: emacs-orgmode


> > Sounds like the expiration mechanism one can find into gnus. I like the
> > idea.
> 
> Quite a nice idea.  In fact... DONE.

Wonderful ! Please Carsten, would you mind considering to install this useful
change.

Xavier

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Re: Autoarchiving done entries
  2007-09-04  7:02       ` Xavier Maillard
@ 2007-09-05  3:42         ` Carsten Dominik
  0 siblings, 0 replies; 8+ messages in thread
From: Carsten Dominik @ 2007-09-05  3:42 UTC (permalink / raw)
  To: Xavier Maillard; +Cc: emacs-orgmode


On Sep 4, 2007, at 9:02, Xavier Maillard wrote:

>
>>> Sounds like the expiration mechanism one can find into gnus. I like 
>>> the
>>> idea.
>>
>> Quite a nice idea.  In fact... DONE.
>
> Wonderful ! Please Carsten, would you mind considering to install this 
> useful
> change.

Certainly.

- Carsten

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-09-05  3:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2007-09-04  7:02       ` Xavier Maillard
2007-09-05  3:42         ` Carsten Dominik
2007-09-03  3:12 ` 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).