emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: display-time, mail-icon and POP3 mailboxes


From: Kim F. Storm
Subject: Re: display-time, mail-icon and POP3 mailboxes
Date: 14 Feb 2002 10:41:21 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50

Richard Stallman <address@hidden> writes:

>     If it is non-nil, a non-blocking connect is attempted - if supported
>     by the o/s (and the emacs code) - and when the connection is
>     established, the argument (which must be a function) is called to
>     initiate using the connection.
> 
> Would it make sense to use the sentinel function for this?  It already
> does a similar job.

Yes, that sounds like a good idea.

The steps for making a non-blocking open-network-stream could be:

(defun my-stream-connected (p)
  ...)

(defun my-sentinel (p s)
  (cond
    ((equal s "connected\n") ...)
      ;; connection established
      (my-stream-connected p))
    ((equal s "failed\n") ...)
      ;; connect failed
      )
    (t ...)))

(defun ...
  (setq p (open-network-stream .... t))
  (when p
    (cond
     ((eq (process-status p) 'connecting)     ;; New return value
      ;; connecting, so set sentinel
      (set-process-sentinel p 'my-sentinel))
     ((eq (process-status p) 'open)
      ;; non-blocking connect not supported, connected
      (my-stream-connected p))
     ((eq (process-status p) 'closed)
      ;; failure...  
      ;; will this happen? -- open-network-stream should return nil instead
      (delete-process p)  ;; necessary?
      (setq p nil)))))

Doesn't seem to be too complicated to use...

-- 
Kim F. Storm <address@hidden> http://www.cua.dk




reply via email to

[Prev in Thread] Current Thread [Next in Thread]