Be a bit more lax in finding the end of the command we're looking for.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sat, 18 Sep 2010 20:38:51 +0000 (22:38 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sat, 18 Sep 2010 20:38:51 +0000 (22:38 +0200)
This helps when the server sends more responses after we've gotten
everything we expected.

lisp/ChangeLog
lisp/nnimap.el

index a401713..2278db3 100644 (file)
@@ -5,6 +5,9 @@
        (nnimap-request-group): Don't make `M-g' bug out on group with no
        marks.
        (nnoo): Required, so that other packages can require nnimap.
+       (nnimap-wait-for-response): Be a bit more lax in finding the end of the
+       command we're looking for.  This helps when the server sends more
+       responses after we've gotten everything we expected.
 
 2010-09-18  Julien Danjou  <julien@danjou.info>
 
index 63b468c..2a83bde 100644 (file)
@@ -811,10 +811,9 @@ not done by default on servers that doesn't support that command.")
 
 (defun nnimap-wait-for-response (sequence &optional messagep)
   (goto-char (point-max))
-  (while (or (bobp)
-            (progn
-              (forward-line -1)
-              (not (looking-at (format "^%d .*\n" sequence)))))
+  (while (not (re-search-backward (format "^%d .*\n" sequence)
+                                 (max (point-min) (- (point) 500))
+                                 t))
     (when messagep
       (message "Read %dKB" (/ (buffer-size) 1000)))
     (nnheader-accept-process-output (get-buffer-process (current-buffer)))