Gnus development mailing list
 help / color / mirror / Atom feed
From: "Sergio Martínez" <samf0xb58@gmail.com>
To: Erik Colson <eco@ecocode.net>
Cc: "Gnus" <ding@gnus.org>
Subject: Re: filtering mail from a group
Date: Mon, 30 Apr 2012 23:05:48 -0500	[thread overview]
Message-ID: <87k40w1r6r.fsf@tesla.pmx> (raw)
In-Reply-To: <m2obq9h9c4.fsf@ecocode.net> (Erik Colson's message of "Mon, 30 Apr 2012 11:12:27 +0200")

Erik Colson <eco@ecocode.net> writes:
>
> Hi Sergio!
>
> Thanks for your answer!
> I don't want to put mails in another mailbox. I want to limit the mails
> to mails posted after a certain date, without removing the older ones
> from the mailbox. It is doable with / t but that makes me calculate
> again and again the number of days since the 'filter date'. Because / t
> requires to enter a number of days and not a date...
>
> Thanks for helping !
> --
> erik

OK, maybe this can help you:

---------------------------------------------------------------
(defun gnus-summary-limit-to-date (date &optional after-p)
  "Limit the summary buffer to articles before DATE.
If AFTER-P (the prefix) is non-nil, limit the summary buffer to
articles that are after DATE."
  (interactive 
   (let ((after current-prefix-arg)
	 date-string)
     (setq date-string
	   (if after
	       (read-string "Limit to after the date: ")
	     (read-string "Limit to before the date: ")))
     (list date-string after)))
  (let (date-string age)
    (setq date-string
	  (if (string-match-p ":+" date)
	      date
	    (concat date " 00:00" )))
    (setq age (days-between (current-time-string) date-string))
    (gnus-summary-limit-to-age age after-p)))
----------------------------------------------------------------

Put this in your .emacs or .gnus file, then in the summary buffer do
M-x gnus-summary-limit-to-date RET.
It prompts you for a date to limit articles before that date or after if
a prefix argument is given (i.e. C-u M-x gnus-summary-limit-to-date RET).

Note that the date is in a format accepted by `parse-time-string', for
example: "2012-01-01" or "Mon, 30 Apr 2012 22:40:05 -0500", etc.

I hope this can be useful. Let me know if it does not fit your needs.

--
Sergio




      reply	other threads:[~2012-05-01  4:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-28  8:43 Erik Colson
2012-04-28 11:56 ` Andreas Schwab
2012-04-28 15:12   ` Erik Colson
2012-04-30  0:44     ` Sergio Martínez
2012-04-30  9:12       ` Erik Colson
2012-05-01  4:05         ` Sergio Martínez [this message]

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=87k40w1r6r.fsf@tesla.pmx \
    --to=samf0xb58@gmail.com \
    --cc=ding@gnus.org \
    --cc=eco@ecocode.net \
    /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).