Gnus development mailing list
 help / color / mirror / Atom feed
* scanning for new mail with demon-handler
@ 2011-06-17 16:54 lee
  2011-06-17 17:04 ` Adam Sjøgren
  0 siblings, 1 reply; 10+ messages in thread
From: lee @ 2011-06-17 16:54 UTC (permalink / raw)
  To: ding

Hi,

in ~/.gnus.el, I have

,----
| (gnus-demon-add-handler 'gnus-demon-scan-mail 3 5)
| (gnus-demon-add-handler 'gnus-demon-close-connections nil 25)
| (gnus-demon-init)
`----

which makes gnus scan for new mail automatically. Unfortunately, the new
mail doesn´t show up in the groups it has been split into after gnus has
performed the scan. It shows up after pressing g in the group view,
though.

Do I need to use gnus-demon-add-scanmail instead, or am I missing
something?



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: scanning for new mail with demon-handler
  2011-06-17 16:54 scanning for new mail with demon-handler lee
@ 2011-06-17 17:04 ` Adam Sjøgren
  2011-06-17 19:05   ` lee
  0 siblings, 1 reply; 10+ messages in thread
From: Adam Sjøgren @ 2011-06-17 17:04 UTC (permalink / raw)
  To: ding

On Fri, 17 Jun 2011 18:54:27 +0200, lee wrote:

> | (gnus-demon-add-handler 'gnus-demon-scan-mail 3 5)

> which makes gnus scan for new mail automatically. Unfortunately, the new
> mail doesn´t show up in the groups it has been split into after gnus has
> performed the scan. It shows up after pressing g in the group view,
> though.

> Do I need to use gnus-demon-add-scanmail instead, or am I missing
> something?

gnus-demon-scan-news does what you are asking for. And maybe more.


  Best regards,

    Adam

-- 
 "He also no longer jokes about world domination; it          Adam Sjøgren
  was only funny when it was obviously meant in jest."   asjo@koldfront.dk




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: scanning for new mail with demon-handler
  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
  0 siblings, 2 replies; 10+ messages in thread
From: lee @ 2011-06-17 19:05 UTC (permalink / raw)
  To: ding

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

> On Fri, 17 Jun 2011 18:54:27 +0200, lee wrote:
>
>> | (gnus-demon-add-handler 'gnus-demon-scan-mail 3 5)
>
>> which makes gnus scan for new mail automatically. Unfortunately, the new
>> mail doesn´t show up in the groups it has been split into after gnus has
>> performed the scan. It shows up after pressing g in the group view,
>> though.
>
>> Do I need to use gnus-demon-add-scanmail instead, or am I missing
>> something?
>
> gnus-demon-scan-news does what you are asking for. And maybe more.

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.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: scanning for new mail with demon-handler
  2011-06-17 19:05   ` lee
@ 2011-06-17 19:17     ` Adam Sjøgren
  2011-06-17 19:19     ` Adam Sjøgren
  1 sibling, 0 replies; 10+ messages in thread
From: Adam Sjøgren @ 2011-06-17 19:17 UTC (permalink / raw)
  To: ding

On Fri, 17 Jun 2011 21:05:06 +0200, lee wrote:

>> gnus-demon-scan-news does what you are asking for. And maybe more.

> 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.

Also, it updates the *Group* buffer.


  Best regards,

    Adam

-- 
 "He also no longer jokes about world domination; it          Adam Sjøgren
  was only funny when it was obviously meant in jest."   asjo@koldfront.dk




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: scanning for new mail with demon-handler
  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
  1 sibling, 1 reply; 10+ messages in thread
From: Adam Sjøgren @ 2011-06-17 19:19 UTC (permalink / raw)
  To: ding

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.


  Best regards,

-- 
 "He also no longer jokes about world domination; it          Adam Sjøgren
  was only funny when it was obviously meant in jest."   asjo@koldfront.dk




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: scanning for new mail with demon-handler
  2011-06-17 19:19     ` Adam Sjøgren
@ 2011-06-17 20:34       ` lee
  2011-06-19 16:49         ` Philipp Haselwarter
  0 siblings, 1 reply; 10+ messages in thread
From: lee @ 2011-06-17 20:34 UTC (permalink / raw)
  To: ding

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.

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

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: scanning for new mail with demon-handler
  2011-06-17 20:34       ` lee
@ 2011-06-19 16:49         ` Philipp Haselwarter
  2011-06-19 18:08           ` lee
  2011-06-19 22:07           ` Adam Sjøgren
  0 siblings, 2 replies; 10+ messages in thread
From: Philipp Haselwarter @ 2011-06-19 16:49 UTC (permalink / raw)
  To: ding

[-- 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: scanning for new mail with demon-handler
  2011-06-19 16:49         ` Philipp Haselwarter
@ 2011-06-19 18:08           ` lee
  2011-06-19 22:07           ` Adam Sjøgren
  1 sibling, 0 replies; 10+ messages in thread
From: lee @ 2011-06-19 18:08 UTC (permalink / raw)
  To: ding

Philipp Haselwarter <philipp.haselwarter@gmx.de> writes:

> 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'd suggest something like
>
> 	Modified   lisp/gnus-demon.el
> diff --git a/lisp/gnus-demon.el b/lisp/gnus-demon.el
>
> 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

That´s a good idea :) Any chance of this becoming the default?

BTW, since you´re setting timestamps, did you get nndiary to work? I
managed to get an "nndiary:diary" group in the group view after manually
creating the group (The documentation should point out that you need to
create the group manually ...), yet nndiary does nothing. It doesn´t
receive new mail from its source, and when I move messages manually into
the diary group, nothing happens either.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: scanning for new mail with demon-handler
  2011-06-19 16:49         ` Philipp Haselwarter
  2011-06-19 18:08           ` lee
@ 2011-06-19 22:07           ` Adam Sjøgren
  2011-06-20  2:19             ` Philipp Haselwarter
  1 sibling, 1 reply; 10+ messages in thread
From: Adam Sjøgren @ 2011-06-19 22:07 UTC (permalink / raw)
  To: ding

On Sun, 19 Jun 2011 18:49:58 +0200, Philipp wrote:

> +(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))

[...snipped the last 7...]

That looks like... there must be a better way than such repetition?

>   (gnus-demon-add-handler 'gnus-demon-scan-news-1 121 10)

Maybe you could do something like a lambda here instead? Along the lines
of

 (gnus-demon-add-handler '(lambda () (gnus-demon-scan-news 1)) 121 10)

or something?


  Best regards,

    Adam - not an expert.

-- 
 "That's one of the remarkable things about life. It's        Adam Sjøgren
  never so bad that it can't get worse."                 asjo@koldfront.dk




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: scanning for new mail with demon-handler
  2011-06-19 22:07           ` Adam Sjøgren
@ 2011-06-20  2:19             ` Philipp Haselwarter
  0 siblings, 0 replies; 10+ messages in thread
From: Philipp Haselwarter @ 2011-06-20  2:19 UTC (permalink / raw)
  To: ding

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

On 2011-06-19 22:07 UT, Adam Sjøgren <asjo@koldfront.dk> wrote:

AS> On Sun, 19 Jun 2011 18:49:58 +0200, Philipp wrote:

>> +(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))

AS> [...snipped the last 7...]

AS> That looks like...there must be a better way than such repetition?

>> (gnus-demon-add-handler 'gnus-demon-scan-news-1 121 10)

AS> Maybe you could do something like a lambda here instead?Along the
AS> lines of

AS>  (gnus-demon-add-handler '(lambda () (gnus-demon-scan-news 1)) 121
AS> 10)

AS> or something?

Using lambda-forms on timers has the same problem as their usage on
hooks, they're a pain to deal with once you added them. Simple overriding
or removing them fails. Evaluating gnus-demon-add-handler several times
results in a new timer getting added every time.

#+begin_src emacs-lisp
(gnus-demon-add-handler (lambda () (message "foo")) 8 3)
;; comparison with `eq' fails with current code:
(gnus-demon-remove-handler (lambda () (message "foo")))
#+end_src

Then again, this could be easily fixed, which would certainly make
sense, no matter if the fsets are provided or not:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: allow lambda-forms as gnus-demon-handler --]
[-- Type: text/x-patch, Size: 516 bytes --]

	Modified   lisp/gnus-demon.el
diff --git a/lisp/gnus-demon.el b/lisp/gnus-demon.el
index 419346b..c799a3c 100644
--- a/lisp/gnus-demon.el
+++ b/lisp/gnus-demon.el
@@ -87,7 +87,7 @@ Emacs has been idle for IDLE `gnus-demon-timestep's."
 
 (defun gnus-demon-remove-handler (function &optional no-init)
   "Remove the handler FUNCTION from the list of handlers."
-  (gnus-alist-pull function gnus-demon-handlers)
+  (gnus-alist-pull function gnus-demon-handlers 'use-assoc)
   (unless no-init
     (gnus-demon-init)))

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



AS>   Best regards,

AS>     Adam - not an expert.

best,

-- 
Philipp Haselwarter

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-06-20  2:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-17 16:54 scanning for new mail with demon-handler 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
2011-06-19 18:08           ` lee
2011-06-19 22:07           ` Adam Sjøgren
2011-06-20  2:19             ` Philipp Haselwarter

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).