Changes committed gnus/lisp (ChangeLog nnheader.el pop3.el)

"Reiner Steib" <[email protected]> Mon, 22 Dec 2008 22:34:55 +0100
Newsgroups gmane.emacs.gnus.commits
Message-ID <[email protected]>
Modified: ChangeLog nnheader.el pop3.el

* nnheader.el (nnheader-read-timeout, nnheader-accept-process-output):
Add explanations.

* pop3.el (pop3-accept-process-output, pop3-read-timeout): Use
nnheader-accept-process-output and nnheader-read-timeout if available.
(pop3-movemail): Use it.


Index: ChangeLog
diff -u gnus/lisp/ChangeLog:7.1951 gnus/lisp/ChangeLog:7.1952
--- ChangeLog:7.1951	Mon Dec 22 22:25:20 2008
+++ ChangeLog	Mon Dec 22 22:34:55 2008
@@ -1,5 +1,12 @@
 2008-12-22  Reiner Steib  <[email protected]>
 
+	* nnheader.el (nnheader-read-timeout, nnheader-accept-process-output):
+	Add explanations.
+
+	* pop3.el (pop3-accept-process-output, pop3-read-timeout): Use
+	nnheader-accept-process-output and nnheader-read-timeout if available.
+	(pop3-movemail): Use it.
+
 	* message.el (message-check-news-body-syntax): Fix signature check if
 	there's an attachment.
 
Index: nnheader.el
diff -u gnus/lisp/nnheader.el:7.35 gnus/lisp/nnheader.el:7.36
--- nnheader.el:7.35	Wed Jun 11 16:19:44 2008
+++ nnheader.el	Mon Dec 22 22:34:55 2008
@@ -86,7 +86,14 @@
       ;; what's possible.  Perhaps better, maybe the Windows/DOS primitive
       ;; could round up non-zero timeouts to a minimum of 1.0?
       1.0
+    ;; 2008-05-19 change by Larsi:
+    ;; Change the default timeout from 0.1 seconds to 0.01 seconds.  This will
+    ;; make nntp and pop3 article retrieval faster in some cases, but might
+    ;; make CPU usage larger.  If this has any bad side effects, we might
+    ;; revert this change.
     0.01)
+  ;; When changing this variable, consider changing `pop3-read-timeout' as
+  ;; well.
   "How long nntp should wait between checking for the end of output.
 Shorter values mean quicker response, but are more CPU intensive.")
 
@@ -1057,6 +1064,8 @@
 (defalias 'nnheader-cancel-timer 'cancel-timer)
 (defalias 'nnheader-cancel-function-timers 'cancel-function-timers)
 
+;; When changing this function, consider changing `pop3-accept-process-output'
+;; as well.
 (defun nnheader-accept-process-output (process)
   (accept-process-output
    process
Index: pop3.el
diff -u gnus/lisp/pop3.el:7.37 gnus/lisp/pop3.el:7.38
--- pop3.el:7.37	Thu Jun  5 08:23:11 2008
+++ pop3.el	Mon Dec 22 22:34:55 2008
@@ -105,33 +105,28 @@
 (defvar pop3-read-point nil)
 (defvar pop3-debug nil)
 
-;; Borrowed from nnheader-accept-process-output in nnheader.el.
-(defvar pop3-read-timeout
-  (if (string-match "windows-nt\\|os/2\\|emx\\|cygwin"
-		    (symbol-name system-type))
-      ;; http://thread.gmane.org/[email protected]
-      ;;
-      ;; IIRC, values lower than 1.0 didn't/don't work on Windows/DOS.
-      ;;
-      ;; There should probably be a runtime test to determine the timing
-      ;; resolution, or a primitive to report it.  I don't know off-hand
-      ;; what's possible.  Perhaps better, maybe the Windows/DOS primitive
-      ;; could round up non-zero timeouts to a minimum of 1.0?
-      1.0
-    0.1)
-  "How long pop3 should wait between checking for the end of output.
-Shorter values mean quicker response, but are more CPU intensive.")
-
-;; Borrowed from nnheader-accept-process-output in nnheader.el.
-(defun pop3-accept-process-output (process)
-  (accept-process-output
-   process
-   (truncate pop3-read-timeout)
-   (truncate (* (- pop3-read-timeout
-		   (truncate pop3-read-timeout))
-		1000))))
+;; Borrowed from nnheader-accept-process-output in nnheader.el.  See the
+;; comments there for explanations about the values.
 
-(autoload 'nnheader-accept-process-output "nnheader")
+(eval-and-compile
+  (if (and (fboundp 'nnheader-accept-process-output)
+	   (boundp 'nnheader-read-timeout))
+      (defalias 'pop3-accept-process-output 'nnheader-accept-process-output)
+    ;; Borrowed from `nnheader.el':
+    (defvar pop3-read-timeout
+      (if (string-match "windows-nt\\|os/2\\|emx\\|cygwin"
+			(symbol-name system-type))
+	  1.0
+	0.01)
+      "How long pop3 should wait between checking for the end of output.
+Shorter values mean quicker response, but are more CPU intensive.")
+    (defun pop3-accept-process-output (process)
+      (accept-process-output
+       process
+       (truncate pop3-read-timeout)
+       (truncate (* (- pop3-read-timeout
+		       (truncate pop3-read-timeout))
+		    1000))))))
 
 (defun pop3-movemail (&optional crashbox)
   "Transfer contents of a maildrop to the specified CRASHBOX."
@@ -171,7 +166,7 @@
           (unless pop3-leave-mail-on-server
             (pop3-dele process n))
 	  (setq n (+ 1 n))
-	  (nnheader-accept-process-output process))
+	  (pop3-accept-process-output process))
       (when (and pop3-leave-mail-on-server
 		 (> n 1))
 	(message "pop3.el doesn't support UIDL.  Setting `pop3-leave-mail-on-server'