Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: David Breton <dbreton@cs.sfu.ca>
Subject: Double expiration
Date: Fri, 07 Oct 2005 14:10:58 -0700	[thread overview]
Message-ID: <inirw9m3rx.fsf@maggie.cs.sfu.ca> (raw)

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
      nnmail-fancy-expiry-targets
      '(
        ("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
work.

(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"
   (save-excursion
     (goto-char (point-min))
     (gnus-date-get-time (message-fetch-field "date"))))

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


Thanks for any help,

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


                 reply	other threads:[~2005-10-07 21:10 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=inirw9m3rx.fsf@maggie.cs.sfu.ca \
    --to=dbreton@cs.sfu.ca \
    /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.
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 NNTP newsgroup(s).