* nnheader.el (nnheader-read-timeout, nnheader-accept-process-output):
authorReiner Steib <Reiner.Steib@gmx.de>
Mon, 22 Dec 2008 21:34:55 +0000 (21:34 +0000)
committerReiner Steib <Reiner.Steib@gmx.de>
Mon, 22 Dec 2008 21:34:55 +0000 (21:34 +0000)
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.

lisp/ChangeLog
lisp/nnheader.el
lisp/pop3.el

index 6c37e59..b27147a 100644 (file)
@@ -1,5 +1,12 @@
 2008-12-22  Reiner Steib  <Reiner.Steib@gmx.de>
 
+       * 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 349c452..7c5ddb9 100644 (file)
@@ -86,7 +86,14 @@ Integer values will in effect be rounded up to the nearest multiple of
       ;; 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 @@ See `find-file-noselect' for the arguments."
 (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 64d338e..d5eada6 100644 (file)
@@ -105,33 +105,28 @@ Used for APOP authentication.")
 (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/v9655t3pjo.fsf@marauder.physik.uni-ulm.de
-      ;;
-      ;; 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.
+;; Borrowed from nnheader-accept-process-output in nnheader.el.  See the
+;; comments there for explanations about the values.
+
+(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.")
-
-;; 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))))
-
-(autoload 'nnheader-accept-process-output "nnheader")
+    (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 @@ Shorter values mean quicker response, but are more CPU intensive.")
           (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'