Function: imap-shell-open
imap-shell-open is a byte-compiled function defined in imap.el.gz.
Signature
(imap-shell-open NAME BUFFER SERVER PORT)
Source Code
;; Defined in /usr/src/emacs/lisp/net/imap.el.gz
(defun imap-shell-open (name buffer server port)
(let ((cmds (if (listp imap-shell-program) imap-shell-program
(list imap-shell-program)))
cmd done)
(while (and (not done) (setq cmd (pop cmds)))
(message "imap: Opening IMAP connection with `%s'..." cmd)
(setq imap-client-eol "\n")
(let* ((port (or port imap-default-port))
(coding-system-for-read imap-coding-system-for-read)
(coding-system-for-write imap-coding-system-for-write)
(process-connection-type imap-process-connection-type)
(process (start-process
name buffer shell-file-name shell-command-switch
(format-spec cmd `((?s . ,server)
(?g . ,imap-shell-host)
(?p . ,(number-to-string port))
(?l . ,imap-default-user))))))
(when process
(while (and (memq (process-status process) '(open run))
(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)
(erase-buffer)
(when (memq (process-status process) '(open run))
(setq done process)))))
(if done
(progn
(message "imap: Opening IMAP connection with `%s'...done" cmd)
done)
(message "imap: Opening IMAP connection with `%s'...failed" cmd)
nil)))