diff options
| author | Stefan Monnier | 2005-04-18 13:19:43 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2005-04-18 13:19:43 +0000 |
| commit | 799fba8ff411241f1a6f5d935355142d6861219a (patch) | |
| tree | 45e384f4d4aa2f3655dc10d42ac66cee573b5d61 | |
| parent | 7d603e3f8e85afcde9192526857daa7c238d6b90 (diff) | |
| download | emacs-799fba8ff411241f1a6f5d935355142d6861219a.tar.gz emacs-799fba8ff411241f1a6f5d935355142d6861219a.zip | |
(url-retrieve-synchronously): Work around the fact that
url-http sometimes doesn't call the callback.
| -rw-r--r-- | lisp/url/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/url/url.el | 26 |
2 files changed, 22 insertions, 9 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 82b7f64dc01..a023bdf18c7 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2005-04-18 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * url.el (url-retrieve-synchronously): Work around the fact that | ||
| 4 | url-http sometimes doesn't call the callback. | ||
| 5 | |||
| 1 | 2005-04-04 Lute Kamstra <lute@gnu.org> | 6 | 2005-04-04 Lute Kamstra <lute@gnu.org> |
| 2 | 7 | ||
| 3 | * url-handlers.el (url-handler-mode): Specify :group. | 8 | * url-handlers.el (url-handler-mode): Specify :group. |
diff --git a/lisp/url/url.el b/lisp/url/url.el index a9fd46bc23a..05ef85c9300 100644 --- a/lisp/url/url.el +++ b/lisp/url/url.el | |||
| @@ -180,15 +180,23 @@ no further processing). URL is either a string or a parsed URL." | |||
| 180 | (url-debug 'retrieval | 180 | (url-debug 'retrieval |
| 181 | "Spinning in url-retrieve-synchronously: %S (%S)" | 181 | "Spinning in url-retrieve-synchronously: %S (%S)" |
| 182 | retrieval-done asynch-buffer) | 182 | retrieval-done asynch-buffer) |
| 183 | ;; We used to use `sit-for' here, but in some cases it wouldn't | 183 | (if (memq (process-status proc) '(closed exit signal failed)) |
| 184 | ;; work because apparently pending keyboard input would always | 184 | ;; FIXME: It's not clear whether url-retrieve's callback is |
| 185 | ;; interrupt it before it got a chance to handle process input. | 185 | ;; guaranteed to be called or not. It seems that url-http |
| 186 | ;; `sleep-for' was tried but it lead to other forms of | 186 | ;; decides sometimes consciously not to call it, so it's not |
| 187 | ;; hanging. --Stef | 187 | ;; clear that it's a bug, but even if we need to decide how |
| 188 | (unless (accept-process-output proc) | 188 | ;; url-http can then warn us that the download has completed. |
| 189 | ;; accept-process-output returned nil, maybe because the process | 189 | ;; In the mean time, we use this here workaround. |
| 190 | ;; exited (and may have been replaced with another). | 190 | (setq retrieval-done t) |
| 191 | (setq proc (get-buffer-process asynch-buffer))))) | 191 | ;; We used to use `sit-for' here, but in some cases it wouldn't |
| 192 | ;; work because apparently pending keyboard input would always | ||
| 193 | ;; interrupt it before it got a chance to handle process input. | ||
| 194 | ;; `sleep-for' was tried but it lead to other forms of | ||
| 195 | ;; hanging. --Stef | ||
| 196 | (unless (accept-process-output proc) | ||
| 197 | ;; accept-process-output returned nil, maybe because the process | ||
| 198 | ;; exited (and may have been replaced with another). | ||
| 199 | (setq proc (get-buffer-process asynch-buffer)))))) | ||
| 192 | asynch-buffer))) | 200 | asynch-buffer))) |
| 193 | 201 | ||
| 194 | (defun url-mm-callback (&rest ignored) | 202 | (defun url-mm-callback (&rest ignored) |