From: Lars Magne Ingebrigtsen Date: Sun, 10 Oct 2010 13:24:30 +0000 (+0200) Subject: (nnimap-wait-for-response): If the user hits `C-g', kill the process, too. X-Git-Url: http://cgit.sxemacs.org/?p=gnus;a=commitdiff_plain;h=ba3361aec2ccd5532f875d361dd47be47580d68e (nnimap-wait-for-response): If the user hits `C-g', kill the process, too. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bae698a6d..1ef90fd7a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-10-10 Stefan Monnier + + * nnimap.el (nnimap-wait-for-response): If the user hits `C-g', kill + the process, too. + 2010-10-09 Lars Magne Ingebrigtsen * spam.el (gnus-summary-mode-map): Bind to "$". Suggested by Russ diff --git a/lisp/nnimap.el b/lisp/nnimap.el index b30e58686..6a1c3f57a 100644 --- a/lisp/nnimap.el +++ b/lisp/nnimap.el @@ -1355,20 +1355,28 @@ textual parts.") (defun nnimap-wait-for-response (sequence &optional messagep) (let ((process (get-buffer-process (current-buffer))) openp) - (goto-char (point-max)) - (while (and (setq openp (memq (process-status process) - '(open run))) - (not (re-search-backward - (format "^%d .*\n" sequence) - (if nnimap-streaming - (max (point-min) (- (point) 500)) - (point-min)) - t))) - (when messagep - (message "nnimap read %dk" (/ (buffer-size) 1000))) - (nnheader-accept-process-output process) - (goto-char (point-max))) - openp)) + (condition-case nil + (progn + (goto-char (point-max)) + (while (and (setq openp (memq (process-status process) + '(open run))) + (not (re-search-backward + (format "^%d .*\n" sequence) + (if nnimap-streaming + (max (point-min) (- (point) 500)) + (point-min)) + t))) + (when messagep + (message "nnimap read %dk" (/ (buffer-size) 1000))) + (nnheader-accept-process-output process) + (goto-char (point-max))) + openp) + (quit + ;; The user hit C-g while we were waiting: kill the process, in case + ;; it's a gnutls-cli process that's stuck (tends to happen a lot behind + ;; NAT routers). + (delete-process process) + nil)))) (defun nnimap-parse-response () (let ((lines (split-string (nnimap-last-response-string) "\r\n" t))