[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Double expiration

From: David Breton
Subject: Double expiration
Date: Fri, 07 Oct 2005 14:10:58 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.2 (gnu/linux)

Hi all,

I'm playing around with my expiration process and I just can't make it
do what I want it to do.  Right now I'm expiring my nnml mail using
the following:

;;Expire mail
(setq nnmail-expiry-target 'nnmail-fancy-expiry-target
        ("from" ".*" "nnfolder+archive:archived-mail-%Y-%m")))

I also save sent mail using the following:

;;Save sent mail
(setq gnus-message-archive-group
      '((if (message-mail-p)
            (concat "sent-mail-" (format-time-string 
                                  "%Y-%m" (current-time))))))

This of course works fine.  Unfortunately, after a while I get lots of
those archived-mail-yyyy-mm and sent-mail-yyyy-mm in my archive dir.
I just don't like it.  What I'd like is to have the
archived-mail-yyyy-mm expire after say 90 days into
archived-mail-yyyy.  This would reduce the number of files I have and
make me happy.  Any ideas?  So far I tried the following but it didn't

(defun my-gnus-expiry-target (group)
   "Archive recent mail by year-month and old mail by year"
   (if (string-match "archived-mail-....-.." group)
       (concat "nnfolder+archive:archived-mail-" 
               (format-time-string "%Y" (my-gnus-get-article-date)))
     (if (string-match "sent-mail-....-.." group)
         (concat "nnfolder+archive:sent-mail-" 
                 (format-time-string "%Y" (my-gnus-get-article-date)))
       (concat "nnfolder+archive:archived-mail-" 
               (format-time-string "%Y-%m" (my-gnus-get-article-date)))))))

(defun my-gnus-get-article-date ()
   "Extracts the date from the current article and converts it to Emacs time"
     (goto-char (point-min))
     (gnus-date-get-time (message-fetch-field "date"))))

(setq nnmail-expiry-target 'my-gnus-expiry-target)

Thanks for any help,

This isn't right.  This isn't even wrong.
                -- Wolfgang Pauli

reply via email to

[Prev in Thread] Current Thread [Next in Thread]