Gnus development mailing list
 help / color / mirror / Atom feed
From: Philipp Haselwarter <philipp.haselwarter@gmx.de>
To: ding@gnus.org
Subject: Re: scanning for new mail with demon-handler
Date: Sun, 19 Jun 2011 18:49:58 +0200	[thread overview]
Message-ID: <87oc1tlqa1.fsf@nzebook.haselwarter.org> (raw)
In-Reply-To: <87aadgkxi3.fsf@yun.yagibdah.de>

[-- Attachment #1: Type: text/plain, Size: 1090 bytes --]

On 2011-06-17 20:34 UT, lee  <lee@yun.yagibdah.de> wrote:

l> asjo@koldfront.dk (Adam Sjøgren) writes:

>> On Fri, 17 Jun 2011 21:05:06 +0200, lee wrote:
>> 
>>> Yes, it does more, that´s why I like gnus-demon-scan-mail :)
>>> Gnus-demon-scan-news also scans for new news, creating unneccessary
>>> network traffic and load on the news servers.
>> 
>> If you put your mail groups on a different level than your
>> newsgroups, maybe you can use a customized version of
>> gnus-demon-scan-news to do what you want.

l> Hm, I´ve read a post saying that you could set newsgroups to a higher
l> level for them not to be included when checking for new messages.I
l> tried that, found that it didn´t work and learned that the levels are
l> also used to distinguish between unsubscribed and zomie groups.So I
l> decided to better not play with group levels until I know better what
l> I´m doing.

l> Unfortunately, I don´t know yet how to make a customized function
l> like that ...There´s so much to learn when you start using gnus that
l> it´ll take a while.

I'd suggest something like


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1567 bytes --]

	Modified   lisp/gnus-demon.el
diff --git a/lisp/gnus-demon.el b/lisp/gnus-demon.el
index 419346b..6146b53 100644
--- a/lisp/gnus-demon.el
+++ b/lisp/gnus-demon.el
@@ -191,15 +191,34 @@ minutes, the connection is closed."
   "Add daemonic scanning of new articles from all backends."
   (gnus-demon-add-handler 'gnus-demon-scan-news 120 60))
 
-(defun gnus-demon-scan-news ()
+(defun gnus-demon-scan-news (&optional arg)
   (let ((win (current-window-configuration)))
     (unwind-protect
 	(save-window-excursion
 	  (when (gnus-alive-p)
 	    (with-current-buffer gnus-group-buffer
-	      (gnus-group-get-new-news))))
+	      (gnus-group-get-new-news arg))))
       (set-window-configuration win))))
 
+(fset 'gnus-demon-scan-news-1
+  (apply-partially 'gnus-demon-scan-news 1))
+(fset 'gnus-demon-scan-news-2
+  (apply-partially 'gnus-demon-scan-news 2))
+(fset 'gnus-demon-scan-news-3
+  (apply-partially 'gnus-demon-scan-news 3))
+(fset 'gnus-demon-scan-news-4
+  (apply-partially 'gnus-demon-scan-news 4))
+(fset 'gnus-demon-scan-news-5
+  (apply-partially 'gnus-demon-scan-news 5))
+(fset 'gnus-demon-scan-news-6
+  (apply-partially 'gnus-demon-scan-news 6))
+(fset 'gnus-demon-scan-news-7
+  (apply-partially 'gnus-demon-scan-news 7))
+(fset 'gnus-demon-scan-news-8
+  (apply-partially 'gnus-demon-scan-news 8))
+(fset 'gnus-demon-scan-news-9
+  (apply-partially 'gnus-demon-scan-news 9))
+
 (defun gnus-demon-add-scan-timestamps ()
   "Add daemonic updating of timestamps in empty newgroups."
   (gnus-demon-add-handler 'gnus-demon-scan-timestamps nil 30))

[-- Attachment #3: Type: text/plain, Size: 416 bytes --]


For example, I keep local mail on level 1, external mail on 3, nntp on 4
and nnrss on level 5 and fetch them accordingly:

#+begin_src emacs-lisp
  (gnus-demon-add-handler 'gnus-demon-scan-news-1 121 10)
  (gnus-demon-add-handler 'gnus-demon-scan-news-3 240 10)
  (gnus-demon-add-handler 'gnus-demon-scan-news-4 601 10)
  (gnus-demon-add-handler 'gnus-demon-scan-news-5 7201 10)
#+end_src


-- 
Philipp Haselwarter

  reply	other threads:[~2011-06-19 16:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-17 16:54 lee
2011-06-17 17:04 ` Adam Sjøgren
2011-06-17 19:05   ` lee
2011-06-17 19:17     ` Adam Sjøgren
2011-06-17 19:19     ` Adam Sjøgren
2011-06-17 20:34       ` lee
2011-06-19 16:49         ` Philipp Haselwarter [this message]
2011-06-19 18:08           ` lee
2011-06-19 22:07           ` Adam Sjøgren
2011-06-20  2:19             ` Philipp Haselwarter

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=87oc1tlqa1.fsf@nzebook.haselwarter.org \
    --to=philipp.haselwarter@gmx.de \
    --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).