Gnus development mailing list
 help / color / mirror / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: ding@gnus.org, emacs-devel@gnu.org
Subject: Re: url.el blocks Gnus+nnrss
Date: Thu, 13 Jan 2005 09:35:15 -0500	[thread overview]
Message-ID: <87pt09v2m1.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <b9yy8explrg.fsf@jpl.org> (Katsumi Yamaoka's message of "Thu, 13 Jan 2005 21:16:19 +0900")

> Several people reported that Gnus hangs if they subscribe to
> nnrss groups.  nnrss is a back end which uses the url ELisp
> package by default and enables to read rss feeds as if they were
> newsgroups.

I've myself been using the patch below for a while now (it basically does
the same as yours, except it hoists the get-buffer-process outside the loop
and it removes the timeout since it shouldn't be needed now that Emacs knows
what we're waiting for).

I've just installed it.


        Stefan


--- orig/lisp/url/url.el
+++ mod/lisp/url/url.el
@@ -1,6 +1,7 @@
 ;;; url.el --- Uniform Resource Locator retrieval tool
 
-;; Copyright (c) 1996,1997,1998,1999,2001,2004  Free Software Foundation, Inc.
+;; Copyright (c) 1996, 1997, 1998, 1999, 2001, 2004, 2005
+;;           Free Software Foundation, Inc.
 
 ;; Author: Bill Perry <wmperry@gnu.org>
 ;; Keywords: comm, data, processes, hypermedia
@@ -169,26 +169,24 @@
 			      (url-debug 'retrieval "Synchronous fetching done (%S)" (current-buffer))
 			      (setq retrieval-done t
 				    asynch-buffer (current-buffer)))))
-    (if (not asynch-buffer)
+    (let ((proc (and asynch-buffer (get-buffer-process asynch-buffer))))
+      (if (null proc)
 	;; We do not need to do anything, it was a mailto or something
 	;; similar that takes processing completely outside of the URL
 	;; package.
 	nil
       (while (not retrieval-done)
 	(url-debug 'retrieval "Spinning in url-retrieve-synchronously: %S (%S)"
 		   retrieval-done asynch-buffer)
-	;; Quoth Stef:
-	;; It turns out that the problem seems to be that the (sit-for
-	;; 0.1) below doesn't actually process the data: instead it
-	;; returns immediately because there is keyboard input
-	;; waiting, so we end up spinning endlessly waiting for the
-	;; process to finish while not letting it finish.
-
-	;; However, raman claims that it blocks Emacs with Emacspeak
-	;; for unexplained reasons.  Put back for his benefit until
-	;; someone can understand it.
-	;; (sleep-for 0.1)
-	(sit-for 0.1))
+	  ;; We used to use `sit-for' here, but in some cases it wouldn't
+	  ;; work because apparently pending keyboard input would always
+	  ;; interrupt it before it got a chance to handle process input.
+	  ;; `sleep-for' was tried but it lead to other forms of
+	  ;; hanging.  --Stef
+	  (unless (accept-process-output proc)
+	    ;; accept-process-output returned nil, maybe because the process
+	    ;; exited (and may have been replaced with another).
+	    (setq proc (get-buffer-process asynch-buffer)))))
       asynch-buffer)))
 
 (defun url-mm-callback (&rest ignored)

  reply	other threads:[~2005-01-13 14:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-13 12:16 Katsumi Yamaoka
2005-01-13 14:35 ` Stefan Monnier [this message]
2005-01-13 22:39   ` Katsumi Yamaoka

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

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

  git send-email \
    --in-reply-to=87pt09v2m1.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --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.
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).