Gnus development mailing list
 help / color / mirror / Atom feed
From: Shenghuo ZHU <zsh@cs.rochester.edu>
Subject: Re: gnus-group-get-new-news broken again
Date: 05 Dec 1999 11:24:17 -0500	[thread overview]
Message-ID: <2n1z911hla.fsf@tiger.jia.vnet> (raw)
In-Reply-To: <iluwvqto1to.fsf@badis.pdc.kth.se>

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

>>>>> "Simon" == Simon Josefsson <jas@pdc.kth.se> writes:

Simon> Shenghuo ZHU <zsh@cs.rochester.edu> writes:
>> I think the patch speed up most mail sources correctly except
>> directory, since there is a hack code in nnmail-get-new-mail
>> (nnmail.el:1426), which only fetch the contents of a single group's
>> spool file. With the patch, `2 g' fetching for the first group
>> inhibits fetching from other spool files.  For those users who do not
>> use directory as a mail source, this patch would not be a problem.

Simon> Ouch. This patch add the hack to the scanning part too, but
Simon> this is getting quite messy. It wouldn't work if `mail-sources'
Simon> can be a group parameter (or non-global in any way), but I'm
Simon> not sure if it can be, so...  Whatdoyouthink, should I apply
Simon> this or remove my earlier speed-up patch?

[...]

Speed up patch is good for most cases, at least people like the
speed.

Actually, Lars had put some codes to avoid multiply fetching a mail
source, see `nnmail-fetched-sources'.  So, the message "%s: Reading
incoming mail (no new mail)...done" does not mean that Gnus fetches
those mail sources again, while "%s: Reading incoming mail from %s..." 
means it fetches. But the overhead, such as nnmail-active and
nnmail-cache-open, may cost some.  So, I am thinking to speed up
nnmail-get-new-mail by checking sources before actually doing
something, so that Gnus still scan backend without fetch mail for most
cases (except directory).  See the attached patch. What do you think?

Now, let's return to the beginning of this thread. I am not sure
whether Bruce and Michael use directory. If not, Simon's speed up
patch wouldn't cause trouble generally.

-- 
Shenghuo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nnmail-5.43zsh.diff --]
[-- Type: text/x-patch, Size: 2741 bytes --]

jIndex: nnmail.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/nnmail.el,v
retrieving revision 5.43
diff -u -r5.43 nnmail.el
--- nnmail.el	1999/12/04 01:11:10	5.43
+++ nnmail.el	1999/12/05 16:25:29
@@ -1393,6 +1393,7 @@
   (let* ((sources (or mail-sources
 		      (if (listp nnmail-spool-file) nnmail-spool-file
 			(list nnmail-spool-file))))
+	 fetching-sources
 	 (group-in group)
 	 (i 0)
 	 (new 0)
@@ -1400,14 +1401,6 @@
 	 incoming incomings source)
     (when (and (nnmail-get-value "%s-get-new-mail" method)
 	       nnmail-spool-file)
-      ;; We first activate all the groups.
-      (nnmail-activate method)
-      ;; Allow the user to hook.
-      (run-hooks 'nnmail-pre-get-new-mail-hook)
-      ;; Open the message-id cache.
-      (nnmail-cache-open)
-      ;; The we go through all the existing mail source specification
-      ;; and fetch the mail from each.
       (while (setq source (pop sources))
 	;; Be compatible with old values.
 	(cond
@@ -1439,21 +1432,31 @@
 	(when nnmail-fetched-sources
 	  (if (member source nnmail-fetched-sources)
 	      (setq source nil)
-	    (push source nnmail-fetched-sources)))
-	(when source
-	  (nnheader-message 4 "%s: Reading incoming mail from %s..."
-			    method (car source))
-	  (when (setq new
-		      (mail-source-fetch
-		       source
-		       `(lambda (file orig-file)
-			  (nnmail-split-incoming
-			   file ',(intern (format "%s-save-mail" method))
-			   ',spool-func
-			   (nnmail-get-split-group orig-file source)
-			   ',(intern (format "%s-active-number" method))))))
-	    (incf total new)
-	    (incf i))))
+	    (push source nnmail-fetched-sources)
+	    (push source fetching-sources)))))
+    (when fetching-sources
+      ;; We first activate all the groups.
+      (nnmail-activate method)
+      ;; Allow the user to hook.
+      (run-hooks 'nnmail-pre-get-new-mail-hook)
+      ;; Open the message-id cache.
+      (nnmail-cache-open)
+      ;; The we go through all the existing mail source specification
+      ;; and fetch the mail from each.
+      (while (setq source (pop fetching-sources))
+	(nnheader-message 4 "%s: Reading incoming mail from %s..."
+			  method (car source))
+	(when (setq new
+		    (mail-source-fetch
+		     source
+		     `(lambda (file orig-file)
+			(nnmail-split-incoming
+			 file ',(intern (format "%s-save-mail" method))
+			 ',spool-func
+			 (nnmail-get-split-group orig-file source)
+			 ',(intern (format "%s-active-number" method))))))
+	  (incf total new)
+	  (incf i)))
       ;; If we did indeed read any incoming spools, we save all info.
       (if (zerop total)
 	  (nnheader-message 4 "%s: Reading incoming mail (no new mail)...done"

  reply	other threads:[~1999-12-05 16:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-04 14:24 Bruce Stephens
1999-12-04 16:52 ` Michael Harnois
1999-12-04 17:17   ` Shenghuo ZHU
1999-12-04 17:46     ` Michael Harnois
1999-12-05  0:43   ` Simon Josefsson
1999-12-05  4:20     ` Shenghuo ZHU
1999-12-05 15:16       ` Simon Josefsson
1999-12-05 16:24         ` Shenghuo ZHU [this message]
1999-12-05 16:53           ` Michael Harnois
1999-12-05 17:01           ` Bruce Stephens

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=2n1z911hla.fsf@tiger.jia.vnet \
    --to=zsh@cs.rochester.edu \
    /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).