emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 2a3bd67: Avoid using obsolete accept-process-output


From: Paul Eggert
Subject: [Emacs-diffs] master 2a3bd67: Avoid using obsolete accept-process-output arg
Date: Tue, 15 Jan 2019 17:09:17 -0500 (EST)

branch: master
commit 2a3bd6798e9670828f0402079fcc116d6d6b042d
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Avoid using obsolete accept-process-output arg
    
    * lisp/gnus/nnheader.el (nnheader-accept-process-output):
    * lisp/net/dns.el (dns-query):
    * lisp/net/imap.el (imap-wait-for-tag):
    * lisp/net/network-stream.el (network-stream-get-response):
    * lisp/net/pop3.el (pop3-accept-process-output):
    * lisp/obsolete/starttls.el (starttls-negotiate-gnutls)
    (starttls-open-stream-gnutls):
    * lisp/server.el (server-eval-at):
    * lisp/textmodes/ispell.el (ispell-accept-output):
    Do not depend on the obsolete milliseconds argument of
    accept-process-output.
---
 lisp/gnus/nnheader.el      | 7 +------
 lisp/net/dns.el            | 5 +++--
 lisp/net/imap.el           | 2 +-
 lisp/net/network-stream.el | 2 +-
 lisp/net/pop3.el           | 7 +------
 lisp/obsolete/starttls.el  | 4 ++--
 lisp/server.el             | 2 +-
 lisp/textmodes/ispell.el   | 8 ++++++--
 8 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el
index 5addc00..7c8673e 100644
--- a/lisp/gnus/nnheader.el
+++ b/lisp/gnus/nnheader.el
@@ -1042,12 +1042,7 @@ See `find-file-noselect' for the arguments."
 ;; When changing this function, consider changing `pop3-accept-process-output'
 ;; as well.
 (defun nnheader-accept-process-output (process)
-  (accept-process-output
-   process
-   (truncate nnheader-read-timeout)
-   (truncate (* (- nnheader-read-timeout
-                  (truncate nnheader-read-timeout))
-               1000))))
+  (accept-process-output process nnheader-read-timeout))
 
 (defun nnheader-update-marks-actions (backend-marks actions)
   (dolist (action actions)
diff --git a/lisp/net/dns.el b/lisp/net/dns.el
index beae5c1..4fa8705 100644
--- a/lisp/net/dns.el
+++ b/lisp/net/dns.el
@@ -432,8 +432,9 @@ If REVERSEP, look up an IP address."
                       tcp-p))
           (while (and (zerop (buffer-size))
                       (> times 0))
-            (sit-for (/ step 1000.0))
-            (accept-process-output process 0 step)
+           (let ((step-sec (/ step 1000.0)))
+             (sit-for step-sec)
+             (accept-process-output process step-sec))
             (setq times (- times step)))
           (condition-case nil
               (delete-process process)
diff --git a/lisp/net/imap.el b/lisp/net/imap.el
index 504900e..0931252 100644
--- a/lisp/net/imap.el
+++ b/lisp/net/imap.el
@@ -1929,7 +1929,7 @@ on failure."
       ;; iteration of the loop above.
       (when (and (null imap-continuation)
                 (< imap-reached-tag tag))
-       (accept-process-output imap-process 0 0))
+       (accept-process-output imap-process 0))
       (when imap-have-messaged
        (message ""))
       (and (memq (process-status imap-process) '(open run))
diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el
index 98b2033..84ba0b8 100644
--- a/lisp/net/network-stream.el
+++ b/lisp/net/network-stream.el
@@ -375,7 +375,7 @@ gnutls-boot (as returned by `gnutls-boot-parameters')."
        (goto-char start)
        (while (and (memq (process-status stream) '(open run))
                    (not (re-search-forward end-of-command nil t)))
-         (accept-process-output stream 0 50)
+         (accept-process-output stream 0.05)
          (goto-char start))
        ;; Return the data we got back, or nil if the process died.
        (unless (= start (point))
diff --git a/lisp/net/pop3.el b/lisp/net/pop3.el
index bcf56c9..3aac5b5 100644
--- a/lisp/net/pop3.el
+++ b/lisp/net/pop3.el
@@ -165,12 +165,7 @@ Used for APOP authentication.")
       "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))))))
+      (accept-process-output process pop3-read-timeout))))
 
 (defvar pop3-uidl)
 ;; List of UIDLs of existing messages at present in the server:
diff --git a/lisp/obsolete/starttls.el b/lisp/obsolete/starttls.el
index b89e612..e0a0968 100644
--- a/lisp/obsolete/starttls.el
+++ b/lisp/obsolete/starttls.el
@@ -217,7 +217,7 @@ handshake, or nil on failure."
                                                starttls-success nil t))
                                 (setq done-bad (re-search-forward
                                                 starttls-failure nil t))))))
-           (accept-process-output process 1 100)
+           (accept-process-output process 1.1)
            (sit-for 0.1))
          (setq info (buffer-substring-no-properties old-max (point-max)))
          (delete-region old-max (point-max))
@@ -251,7 +251,7 @@ handshake, or nil on failure."
                  (goto-char old-max)
                  (not (setq done (re-search-forward
                                   starttls-connect nil t)))))
-      (accept-process-output process 0 100)
+      (accept-process-output process 0.1)
       (sit-for 0.1))
     (if done
        (with-current-buffer buffer
diff --git a/lisp/server.el b/lisp/server.el
index a5d5e56..c38fdf8 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1744,7 +1744,7 @@ returns the process ID of the Emacs instance running 
\"server\"."
                                   (server-quote-arg (format "%S" form))
                                   "\n"))
       (while (memq (process-status process) '(open run))
-       (accept-process-output process 0 10))
+       (accept-process-output process 0.01))
       (goto-char (point-min))
       ;; If the result is nil, there's nothing in the buffer.  If the
       ;; result is non-nil, it's after "-print ".
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 2204759..418901d 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1782,11 +1782,15 @@ You can set this variable in hooks in your init file -- 
eg:
 
 
 (defun ispell-accept-output (&optional timeout-secs timeout-msecs)
-  "Wait for output from Ispell process, or TIMEOUT-SECS and TIMEOUT-MSECS.
+  "Wait for output from Ispell process, or for TIMEOUT-SECS + TIMEOUT-MSECS.
+\(The TIMEOUT-MSECS argument is obsolete and should be avoided.)
 If asynchronous subprocesses are not supported, call function `ispell-filter'
 and pass it the output of the last Ispell invocation."
   (if ispell-async-processp
-      (accept-process-output ispell-process timeout-secs timeout-msecs)
+      (let ((timeout (if timeout-msecs
+                        (+ (or timeout-secs 0) (/ timeout-msecs 1000.0))
+                      timeout-secs)))
+       (accept-process-output ispell-process timeout))
     (if (null ispell-process)
        (error "No Ispell process to read output from!")
       (let ((buf ispell-output-buffer)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]