unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Cc: emacs-devel@gnu.org, ding@gnus.org
Subject: Re: display-time, mail-icon and POP3 mailboxes
Date: 14 Feb 2002 10:41:21 +0100	[thread overview]
Message-ID: <5xlmdwe6ym.fsf@kfs2.cua.dk> (raw)
In-Reply-To: <200202140312.g1E3CMf09146@aztec.santafe.edu>

Richard Stallman <rms@gnu.org> 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 <storm@cua.dk> http://www.cua.dk


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


  parent reply	other threads:[~2002-02-14  9:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-07  9:54 display-time, mail-icon and POP3 mailboxes Pavel Janík
2002-02-08 13:57 ` Richard Stallman
2002-02-08 20:54   ` Pavel Janík
2002-02-08 23:14     ` Kim F. Storm
     [not found]       ` <m3pu3dqizu.fsf@Janik.cz>
2002-02-10 19:57         ` Kim F. Storm
2002-02-11 18:48           ` Richard Stallman
     [not found]           ` <200202111848.g1BIm0406891@aztec.santafe.edu>
2002-02-11 23:31             ` Kim F. Storm
2002-02-12 16:32               ` Paul Jarc
2002-02-13  0:27                 ` Kim F. Storm
2002-02-14  3:12                   ` Richard Stallman
     [not found]                   ` <200202140312.g1E3CMf09146@aztec.santafe.edu>
2002-02-14  9:41                     ` Kim F. Storm [this message]
2002-02-15 10:36                       ` Richard Stallman
2002-02-13 15:38               ` Richard Stallman
     [not found]               ` <200202131538.g1DFcGc08698@aztec.santafe.edu>
2002-02-13 22:13                 ` Kim F. Storm
2002-02-15 10:37                   ` Richard Stallman
2002-02-15 10:37                   ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5xlmdwe6ym.fsf@kfs2.cua.dk \
    --to=storm@cua.dk \
    --cc=ding@gnus.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).