Gnus development mailing list
 help / color / mirror / Atom feed
From: Russ Allbery <rra@stanford.edu>
To: ding@gnus.org
Subject: Re: Restricting frequency of 'g'
Date: Thu, 07 Oct 2010 14:55:07 -0700	[thread overview]
Message-ID: <87tykxmzwk.fsf@windlord.stanford.edu> (raw)
In-Reply-To: <m3mxqp69nn.fsf@quimbies.gnus.org> (Lars Magne Ingebrigtsen's message of "Thu, 07 Oct 2010 22:16:28 +0200")

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:
> Dan Nicolaescu <dann@gnu.org> writes:

>> Any reason not to install this patch?

> The functionality doesn't seem all that compelling...  Would many people
> use it?

I absolutely swear by my implementation, although I wouldn't use the one
that you're responding to.  It's a really valuable tool in helping me
avoid the temptation to spend all day checking my mail.

;; Use this function instead of gnus-group-get-new-news as the action for g.
;; It changes the level of subscribedness that it checks based on how long
;; it's been since the previous check and tries to throttle checking mail too
;; often.
(defvar rra-last-mail-important-check (float-time)
  "The last time I checked mail in important groups.")
(defvar rra-last-mail-normal-check (float-time)
  "The last time I checked mail in normal groups.")
(defvar rra-last-mail-low-check (float-time)
  "The last time I checked mail in low-priority groups.")
(defvar rra-mail-important-check-interval (* 60 15)
  "How long I'm required to wait before checking mail in important groups.")
(defvar rra-mail-normal-check-interval (* 60 30)
  "How long I'm required to wait before checking mail in normal groups.")
(defvar rra-mail-low-check-interval (* 60 60)
  "How long I'm required to wait before checking mail in low-priority groups.")
(defun rra-timed-gnus-group-get-new-news ()
  "Get newly arrived articles based on the interval since the last time I've
checked for new articles."
  (interactive)
  (cond
   ((> (float-time) (+ rra-last-mail-low-check rra-mail-low-check-interval))
    (gnus-group-get-new-news)
    (setq rra-last-mail-low-check (float-time))
    (setq rra-last-mail-normal-check (float-time))
    (setq rra-last-mail-important-check (float-time)))
   ((> (float-time) (+ rra-last-mail-normal-check
                       rra-mail-normal-check-interval))
    (gnus-group-get-new-news 3)
    (setq rra-last-mail-normal-check (float-time))
    (setq rra-last-mail-important-check (float-time)))
   ((> (float-time) (+ rra-last-mail-important-check
                       rra-mail-important-check-interval))
    (gnus-group-get-new-news 1)
    (setq rra-last-mail-important-check (float-time)))
   (t
    (let ((next-check (+ rra-last-mail-important-check
                         rra-mail-important-check-interval)))
      (message (concat "No gnus is good news ("
                       (int-to-string (floor (- next-check (float-time))))
                       " seconds until check allowed)"))))))

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>



  reply	other threads:[~2010-10-07 21:55 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-06  3:36 Russ Allbery
2008-04-06  4:54 ` Bill O'Connor
2008-04-06  6:43   ` Russ Allbery
2008-04-06 11:55 ` John SJ Anderson
2008-04-07  1:30   ` Russ Allbery
2008-04-07 23:45     ` jidanni
2008-04-08  0:54       ` John SJ Anderson
2008-04-08  3:41         ` Russ Allbery
2008-04-08 21:12           ` a Gnus biff (was: Restricting frequency of 'g') Ted Zlatanov
2008-04-09 13:59             ` a Gnus biff Wes Hardaker
2008-04-08  3:55 ` Restricting frequency of 'g' Dan Nicolaescu
2008-04-09  6:49   ` Dan Nicolaescu
2008-04-09 19:22     ` Reiner Steib
2008-04-12 14:58       ` Mark Plaksin
2008-07-29 21:14       ` Dan Nicolaescu
2008-07-30 18:04         ` Reiner Steib
2009-07-30 19:32           ` Dan Nicolaescu
2010-10-07  6:27       ` Dan Nicolaescu
2010-10-07 20:16         ` Lars Magne Ingebrigtsen
2010-10-07 21:55           ` Russ Allbery [this message]
2010-10-08 17:28             ` Ted Zlatanov
2010-10-08 15:14           ` Jason L Tibbitts III
2010-10-09 15:36             ` Lars Magne Ingebrigtsen
2010-10-09 15:50               ` Richard Riley

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=87tykxmzwk.fsf@windlord.stanford.edu \
    --to=rra@stanford.edu \
    --cc=ding@gnus.org \
    /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).