Function: imap-tls-open

imap-tls-open is a byte-compiled function defined in imap.el.gz.

Signature

(imap-tls-open NAME BUFFER SERVER PORT)

Source Code

;; Defined in /usr/src/emacs/lisp/net/imap.el.gz
(defun imap-tls-open (name buffer server port)
  (let* ((port (or port imap-default-tls-port))
	 (coding-system-for-read imap-coding-system-for-read)
	 (coding-system-for-write imap-coding-system-for-write)
	 (process (open-network-stream name buffer server port
                                       :type 'tls)))
    (when process
      (while (and (memq (process-status process) '(open run))
		  ;; FIXME: Per the "blue moon" comment, the process/buffer
		  ;; handling here, and elsewhere in functions which open
		  ;; streams, looks confused.  Obviously we can change buffers
		  ;; if a different process handler kicks in from
		  ;; `accept-process-output' or `sit-for' below, and TRT seems
		  ;; to be to `save-buffer' around those calls.  (I wonder why
		  ;; `sit-for' is used with a non-zero wait.)  -- fx
		  (set-buffer buffer) ;; XXX "blue moon" nntp.el bug
		  (goto-char (point-max))
		  (forward-line -1)
		  (not (imap-parse-greeting)))
	(accept-process-output process 1)
	(sit-for 1))
      (imap-log buffer)
      (when (memq (process-status process) '(open run))
	process))))