Function: imap-wait-for-tag

imap-wait-for-tag is a byte-compiled function defined in imap.el.gz.

Signature

(imap-wait-for-tag TAG &optional BUFFER)

Source Code

;; Defined in /usr/src/emacs/lisp/net/imap.el.gz
(defun imap-wait-for-tag (tag &optional buffer)
  (with-current-buffer (or buffer (current-buffer))
    (let (imap-have-messaged)
      (while (and (null imap-continuation)
		  (memq (process-status imap-process) '(open run))
		  (< imap-reached-tag tag))
	(let ((len (/ (buffer-size) 1024))
	      message-log-max)
	  (unless (< len 10)
	    (setq imap-have-messaged t)
	    (message "imap read: %dk" len))
	  (accept-process-output imap-process imap-read-timeout)))
      ;; A process can die _before_ we have processed everything it
      ;; has to say.  Moreover, this can happen in between the call to
      ;; accept-process-output and the call to process-status in an
      ;; iteration of the loop above.
      (when (and (null imap-continuation)
		 (< imap-reached-tag tag))
	(accept-process-output imap-process 0))
      (when imap-have-messaged
	(message ""))
      (and (memq (process-status imap-process) '(open run))
	   (or (assq tag imap-failed-tags)
	       (if imap-continuation
		   'INCOMPLETE
		 'OK))))))