* Re: display-time, mail-icon and POP3 mailboxes
[not found] ` <5x1yfva7m8.fsf@kfs2.cua.dk>
@ 2002-02-10 18:39 ` Pavel Janík
2002-02-10 19:57 ` Kim F. Storm
[not found] ` <5xn0yhrtye.fsf@kfs2.cua.dk>
0 siblings, 2 replies; 13+ messages in thread
From: Pavel Janík @ 2002-02-10 18:39 UTC (permalink / raw)
Cc: emacs-devel
From: storm@cua.dk (Kim F. Storm)
Date: 09 Feb 2002 00:14:55 +0100
> I think it should at least be able to use the existing gnus and/or
> rmail settings (they cannot be that hard to use).
> You can then add extra mailboxes to check specifically.
>
> What about these options:
> - display-time-pop3-check-rmail (nil/t, default t)
> - display-time-pop3-check-gnus (nil/t, default t)
> - display-time-pop3-mail-boxes (alist (server.passwd), default ())
Hmm, when I think about it - it would be better if those mail programs like
RMAIL and Gnus could tells us alone if there is any new mail. Syntax of
Gnus' mail-sources variable is pretty easy, but Gnus also support IMAP
etc. and we should not duplicate code in display-time. What do you think?
> With the pop3 sample code I posted some time ago, there is one serious
> problem: If emacs cannot connect to the pop3 server, it may hang (no
> user interaction) until the connect times out. That is not
> satisfactory!
>
> I don't know if this is relevant for your code (sorry, but I haven't
> had time to look at the code you sent me).
The same applies to pop3.el from Gnus.
--
Pavel Janík
panic("sun_82072_fd_inb: How did I get here?");
-- 2.2.16 include/asm-sparc/floppy.h
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: display-time, mail-icon and POP3 mailboxes
2002-02-10 18:39 ` display-time, mail-icon and POP3 mailboxes Pavel Janík
@ 2002-02-10 19:57 ` Kim F. Storm
[not found] ` <5xn0yhrtye.fsf@kfs2.cua.dk>
1 sibling, 0 replies; 13+ messages in thread
From: Kim F. Storm @ 2002-02-10 19:57 UTC (permalink / raw)
Cc: GNUS mailing list
Pavel@Janik.cz (Pavel Janík) writes:
> From: storm@cua.dk (Kim F. Storm)
> Date: 09 Feb 2002 00:14:55 +0100
>
> > I think it should at least be able to use the existing gnus and/or
> > rmail settings (they cannot be that hard to use).
> > You can then add extra mailboxes to check specifically.
> >
> > What about these options:
> > - display-time-pop3-check-rmail (nil/t, default t)
> > - display-time-pop3-check-gnus (nil/t, default t)
> > - display-time-pop3-mail-boxes (alist (server.passwd), default ())
>
> Hmm, when I think about it - it would be better if those mail programs like
> RMAIL and Gnus could tells us alone if there is any new mail. Syntax of
> Gnus' mail-sources variable is pretty easy, but Gnus also support IMAP
> etc. and we should not duplicate code in display-time. What do you think?
I agree. It seems to be the right approach for such packages to have
a hook function for display-time to check for unread mail (using whatever
method those packages support for retrieving mail).
>
> > With the pop3 sample code I posted some time ago, there is one serious
> > problem: If emacs cannot connect to the pop3 server, it may hang (no
> > user interaction) until the connect times out. That is not
> > satisfactory!
> >
> > I don't know if this is relevant for your code (sorry, but I haven't
> > had time to look at the code you sent me).
>
> The same applies to pop3.el from Gnus.
In my experience [based on my own pop3 hacks], this is really, really
annoying (since the poll runs through a timer)!!!
If we want to support this in general, we must implement an async
version of open-network-stream (or add an optional arg to it to make
it async - that arg could be a function which is called when the
connection has been opened.
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: display-time, mail-icon and POP3 mailboxes
[not found] ` <5xn0yhrtye.fsf@kfs2.cua.dk>
@ 2002-02-11 18:48 ` Richard Stallman
2002-02-11 23:31 ` Kim F. Storm
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Richard Stallman @ 2002-02-11 18:48 UTC (permalink / raw)
Cc: emacs-devel, ding
> > With the pop3 sample code I posted some time ago, there is one serious
> > problem: If emacs cannot connect to the pop3 server, it may hang (no
> > user interaction) until the connect times out. That is not
> > satisfactory!
>
> The same applies to pop3.el from Gnus.
If we want to support this in general, we must implement an async
version of open-network-stream (or add an optional arg to it to make
it async - that arg could be a function which is called when the
connection has been opened.
Is it hanging in open-network-stream? If so,
precisely where in open-network-stream is it waiting?
It may be a straightforward matter to implement quitting from
a few places where the waiting typically happens.
That would fix this problem.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: display-time, mail-icon and POP3 mailboxes
2002-02-11 18:48 ` Richard Stallman
@ 2002-02-11 23:31 ` Kim F. Storm
[not found] ` <a49p7s$657$1@quimby2.netfonds.no>
[not found] ` <5x3d07iojn.fsf@kfs2.cua.dk>
2 siblings, 0 replies; 13+ messages in thread
From: Kim F. Storm @ 2002-02-11 23:31 UTC (permalink / raw)
Richard Stallman <rms@gnu.org> writes:
> > > With the pop3 sample code I posted some time ago, there is one serious
> > > problem: If emacs cannot connect to the pop3 server, it may hang (no
> > > user interaction) until the connect times out. That is not
> > > satisfactory!
> >
> > The same applies to pop3.el from Gnus.
>
> If we want to support this in general, we must implement an async
> version of open-network-stream (or add an optional arg to it to make
> it async - that arg could be a function which is called when the
> connection has been opened.
>
> Is it hanging in open-network-stream? If so,
> precisely where in open-network-stream is it waiting?
> It may be a straightforward matter to implement quitting from
> a few places where the waiting typically happens.
> That would fix this problem.
I haven't debugged this specifically with emacs, but in other
programs, it has been necessary to make connect non-blocking with
fcntl(s,F_SETFL,O_NONBLOCK) and then use the writefds of select to
know when the connect has completed (at least on GNU/Linux).
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: display-time, mail-icon and POP3 mailboxes
[not found] ` <a49p7s$657$1@quimby2.netfonds.no>
@ 2002-02-12 16:25 ` Jan Vroonhof
0 siblings, 0 replies; 13+ messages in thread
From: Jan Vroonhof @ 2002-02-12 16:25 UTC (permalink / raw)
storm@cua.dk (Kim F. Storm) writes:
> I haven't debugged this specifically with emacs, but in other
> programs, it has been necessary to make connect non-blocking with
> fcntl(s,F_SETFL,O_NONBLOCK) and then use the writefds of select to
> know when the connect has completed (at least on GNU/Linux).
Does anybody know whether Linux generates SIGIO when the socket is
ready in this case, or do you absolutely need to poll using select()?
I also recall somebody stating recently that this behavior isn't
really portable? Can somebody confirm in the positive and/or negative.
Jan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: display-time, mail-icon and POP3 mailboxes
[not found] ` <5x3d07iojn.fsf@kfs2.cua.dk>
@ 2002-02-12 16:32 ` Paul Jarc
[not found] ` <m3u1sm4q4f.fsf@multivac.cwru.edu>
2002-02-13 15:38 ` Richard Stallman
2 siblings, 0 replies; 13+ messages in thread
From: Paul Jarc @ 2002-02-12 16:32 UTC (permalink / raw)
storm@cua.dk (Kim F. Storm) wrote:
> I haven't debugged this specifically with emacs, but in other
> programs, it has been necessary to make connect non-blocking with
> fcntl(s,F_SETFL,O_NONBLOCK) and then use the writefds of select to
> know when the connect has completed (at least on GNU/Linux).
See also <URL:http://cr.yp.to/docs/connect.html>.
paul
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: display-time, mail-icon and POP3 mailboxes
[not found] ` <m3u1sm4q4f.fsf@multivac.cwru.edu>
@ 2002-02-13 0:27 ` Kim F. Storm
[not found] ` <5x4rkmfcp8.fsf@kfs2.cua.dk>
1 sibling, 0 replies; 13+ messages in thread
From: Kim F. Storm @ 2002-02-13 0:27 UTC (permalink / raw)
Cc: ding
prj@po.cwru.edu (Paul Jarc) writes:
> storm@cua.dk (Kim F. Storm) wrote:
> > I haven't debugged this specifically with emacs, but in other
> > programs, it has been necessary to make connect non-blocking with
> > fcntl(s,F_SETFL,O_NONBLOCK) and then use the writefds of select to
> > know when the connect has completed (at least on GNU/Linux).
>
> See also <URL:http://cr.yp.to/docs/connect.html>.
Nice summary, thanks!
In any case, I think it would make sense for open-network-stream
to have an optional 5th argument which serves two purposes:
If it is omitted or nil, the current blocking connect is used.
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. The arguments to that function will
probably be the process and buffer (this is still TBD).
If the o/s (or emacs) does not support non-blocking connect, a
blocking connect will be performed - and the supplied function will
simply be called before open-network-stream returns (it may need
an arg indicating whether a blocking or non-blocking connect was made
to arrange for different things to happen when open-network-stream
returns).
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: display-time, mail-icon and POP3 mailboxes
[not found] ` <5x3d07iojn.fsf@kfs2.cua.dk>
2002-02-12 16:32 ` Paul Jarc
[not found] ` <m3u1sm4q4f.fsf@multivac.cwru.edu>
@ 2002-02-13 15:38 ` Richard Stallman
2002-02-13 22:13 ` Kim F. Storm
[not found] ` <5x3d0558tf.fsf@kfs2.cua.dk>
2 siblings, 2 replies; 13+ messages in thread
From: Richard Stallman @ 2002-02-13 15:38 UTC (permalink / raw)
Cc: emacs-devel, ding
I haven't debugged this specifically with emacs, but in other
programs, it has been necessary to make connect non-blocking with
fcntl(s,F_SETFL,O_NONBLOCK) and then use the writefds of select to
know when the connect has completed (at least on GNU/Linux).
Would you like to write that code?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: display-time, mail-icon and POP3 mailboxes
2002-02-13 15:38 ` Richard Stallman
@ 2002-02-13 22:13 ` Kim F. Storm
[not found] ` <5x3d0558tf.fsf@kfs2.cua.dk>
1 sibling, 0 replies; 13+ messages in thread
From: Kim F. Storm @ 2002-02-13 22:13 UTC (permalink / raw)
Cc: emacs-devel, ding
Richard Stallman <rms@gnu.org> writes:
> I haven't debugged this specifically with emacs, but in other
> programs, it has been necessary to make connect non-blocking with
> fcntl(s,F_SETFL,O_NONBLOCK) and then use the writefds of select to
> know when the connect has completed (at least on GNU/Linux).
>
> Would you like to write that code?
I could give it a try - but I can only test it on GNU/Linux,
so I will need to make some sensible choices about how to
conditionally support this feature.
I think I will need to test for the availability of HAVE_SELECT,
F_SETFL, O_NONBLOCK, and HAVE_GETPEERNAME (which is used to check
whether the connect actually succeeded).
But that might not work on all systems, so I may need to add a
BROKEN_NON_BLOCKING_CONNECT define which can be set for systems where
this doesn't work (just to be defencive).
There is currently no HAVE_GETPEERNAME check in configure, but I
suppose that can be added (by someone who speaks autoconf :-)
--
Kim F. Storm http://www.cua.dk
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: display-time, mail-icon and POP3 mailboxes
[not found] ` <5x4rkmfcp8.fsf@kfs2.cua.dk>
@ 2002-02-14 3:12 ` Richard Stallman
2002-02-14 9:41 ` Kim F. Storm
[not found] ` <5xlmdwe6ym.fsf@kfs2.cua.dk>
0 siblings, 2 replies; 13+ messages in thread
From: Richard Stallman @ 2002-02-14 3:12 UTC (permalink / raw)
Cc: emacs-devel, ding
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.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: display-time, mail-icon and POP3 mailboxes
2002-02-14 3:12 ` Richard Stallman
@ 2002-02-14 9:41 ` Kim F. Storm
[not found] ` <5xlmdwe6ym.fsf@kfs2.cua.dk>
1 sibling, 0 replies; 13+ messages in thread
From: Kim F. Storm @ 2002-02-14 9:41 UTC (permalink / raw)
Cc: emacs-devel, ding
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
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: display-time, mail-icon and POP3 mailboxes
[not found] ` <5xlmdwe6ym.fsf@kfs2.cua.dk>
@ 2002-02-15 10:36 ` Richard Stallman
0 siblings, 0 replies; 13+ messages in thread
From: Richard Stallman @ 2002-02-15 10:36 UTC (permalink / raw)
Cc: emacs-devel, ding
(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))
There may be a timing error here: each call to process-status allows
the value to change.
Perhaps the sentinel should be passed as an argument to
open-network-stream, so that there is no time at which the
connection is open and has no sentinel.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: display-time, mail-icon and POP3 mailboxes
[not found] ` <5x3d0558tf.fsf@kfs2.cua.dk>
@ 2002-02-15 10:37 ` Richard Stallman
0 siblings, 0 replies; 13+ messages in thread
From: Richard Stallman @ 2002-02-15 10:37 UTC (permalink / raw)
Cc: emacs-devel, ding
I think I will need to test for the availability of HAVE_SELECT,
F_SETFL, O_NONBLOCK, and HAVE_GETPEERNAME (which is used to check
whether the connect actually succeeded).
But that might not work on all systems, so I may need to add a
BROKEN_NON_BLOCKING_CONNECT define which can be set for systems where
this doesn't work (just to be defencive).
Ok, that sounds fine.
There is currently no HAVE_GETPEERNAME check in configure, but I
suppose that can be added (by someone who speaks autoconf :-)
If that function would be in libc, it is trivial--just see how the
other such functions are handled and getpeername to the list.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2002-02-15 10:37 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <m3ofj1fwhj.fsf@Janik.cz>
[not found] ` <200202081357.g18Dvfw05454@aztec.santafe.edu>
[not found] ` <m3bsezk837.fsf@Janik.cz>
[not found] ` <5x1yfva7m8.fsf@kfs2.cua.dk>
2002-02-10 18:39 ` display-time, mail-icon and POP3 mailboxes Pavel Janík
2002-02-10 19:57 ` Kim F. Storm
[not found] ` <5xn0yhrtye.fsf@kfs2.cua.dk>
2002-02-11 18:48 ` Richard Stallman
2002-02-11 23:31 ` Kim F. Storm
[not found] ` <a49p7s$657$1@quimby2.netfonds.no>
2002-02-12 16:25 ` Jan Vroonhof
[not found] ` <5x3d07iojn.fsf@kfs2.cua.dk>
2002-02-12 16:32 ` Paul Jarc
[not found] ` <m3u1sm4q4f.fsf@multivac.cwru.edu>
2002-02-13 0:27 ` Kim F. Storm
[not found] ` <5x4rkmfcp8.fsf@kfs2.cua.dk>
2002-02-14 3:12 ` Richard Stallman
2002-02-14 9:41 ` Kim F. Storm
[not found] ` <5xlmdwe6ym.fsf@kfs2.cua.dk>
2002-02-15 10:36 ` Richard Stallman
2002-02-13 15:38 ` Richard Stallman
2002-02-13 22:13 ` Kim F. Storm
[not found] ` <5x3d0558tf.fsf@kfs2.cua.dk>
2002-02-15 10:37 ` Richard Stallman
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 NNTP newsgroup(s).