diff options
| author | Stefan Monnier | 2005-01-13 14:35:11 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2005-01-13 14:35:11 +0000 |
| commit | 944b2ab6ca2ac4ef00b13f147978e03b10ef3701 (patch) | |
| tree | 589b825568b016559541f157a780fe928ee64b5a | |
| parent | 0b5bb6b748cd95970b3c1d89de04b32e5834b6d9 (diff) | |
| download | emacs-944b2ab6ca2ac4ef00b13f147978e03b10ef3701.tar.gz emacs-944b2ab6ca2ac4ef00b13f147978e03b10ef3701.zip | |
(url-retrieve-synchronously): Use accept-process-output rather than sit-for.
| -rw-r--r-- | lisp/url/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/url/url.el | 42 |
2 files changed, 26 insertions, 21 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index b3486e19acd..19f39265251 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2005-01-13 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * url.el (url-retrieve-synchronously): Use accept-process-output rather | ||
| 4 | than sit-for. | ||
| 5 | |||
| 1 | 2005-01-03 Klaus Straubinger <ksnetz@arcor.de> (tiny change) | 6 | 2005-01-03 Klaus Straubinger <ksnetz@arcor.de> (tiny change) |
| 2 | 7 | ||
| 3 | * url-http.el (url-http-handle-authentication): | 8 | * url-http.el (url-http-handle-authentication): |
diff --git a/lisp/url/url.el b/lisp/url/url.el index f94e965129a..a9fd46bc23a 100644 --- a/lisp/url/url.el +++ b/lisp/url/url.el | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | ;;; url.el --- Uniform Resource Locator retrieval tool | 1 | ;;; url.el --- Uniform Resource Locator retrieval tool |
| 2 | 2 | ||
| 3 | ;; Copyright (c) 1996,1997,1998,1999,2001,2004 Free Software Foundation, Inc. | 3 | ;; Copyright (c) 1996, 1997, 1998, 1999, 2001, 2004, 2005 |
| 4 | ;; Free Software Foundation, Inc. | ||
| 4 | 5 | ||
| 5 | ;; Author: Bill Perry <wmperry@gnu.org> | 6 | ;; Author: Bill Perry <wmperry@gnu.org> |
| 6 | ;; Keywords: comm, data, processes, hypermedia | 7 | ;; Keywords: comm, data, processes, hypermedia |
| @@ -169,26 +170,25 @@ no further processing). URL is either a string or a parsed URL." | |||
| 169 | (url-debug 'retrieval "Synchronous fetching done (%S)" (current-buffer)) | 170 | (url-debug 'retrieval "Synchronous fetching done (%S)" (current-buffer)) |
| 170 | (setq retrieval-done t | 171 | (setq retrieval-done t |
| 171 | asynch-buffer (current-buffer))))) | 172 | asynch-buffer (current-buffer))))) |
| 172 | (if (not asynch-buffer) | 173 | (let ((proc (and asynch-buffer (get-buffer-process asynch-buffer)))) |
| 173 | ;; We do not need to do anything, it was a mailto or something | 174 | (if (null proc) |
| 174 | ;; similar that takes processing completely outside of the URL | 175 | ;; We do not need to do anything, it was a mailto or something |
| 175 | ;; package. | 176 | ;; similar that takes processing completely outside of the URL |
| 176 | nil | 177 | ;; package. |
| 177 | (while (not retrieval-done) | 178 | nil |
| 178 | (url-debug 'retrieval "Spinning in url-retrieve-synchronously: %S (%S)" | 179 | (while (not retrieval-done) |
| 179 | retrieval-done asynch-buffer) | 180 | (url-debug 'retrieval |
| 180 | ;; Quoth Stef: | 181 | "Spinning in url-retrieve-synchronously: %S (%S)" |
| 181 | ;; It turns out that the problem seems to be that the (sit-for | 182 | retrieval-done asynch-buffer) |
| 182 | ;; 0.1) below doesn't actually process the data: instead it | 183 | ;; We used to use `sit-for' here, but in some cases it wouldn't |
| 183 | ;; returns immediately because there is keyboard input | 184 | ;; work because apparently pending keyboard input would always |
| 184 | ;; waiting, so we end up spinning endlessly waiting for the | 185 | ;; interrupt it before it got a chance to handle process input. |
| 185 | ;; process to finish while not letting it finish. | 186 | ;; `sleep-for' was tried but it lead to other forms of |
| 186 | 187 | ;; hanging. --Stef | |
| 187 | ;; However, raman claims that it blocks Emacs with Emacspeak | 188 | (unless (accept-process-output proc) |
| 188 | ;; for unexplained reasons. Put back for his benefit until | 189 | ;; accept-process-output returned nil, maybe because the process |
| 189 | ;; someone can understand it. | 190 | ;; exited (and may have been replaced with another). |
| 190 | ;; (sleep-for 0.1) | 191 | (setq proc (get-buffer-process asynch-buffer))))) |
| 191 | (sit-for 0.1)) | ||
| 192 | asynch-buffer))) | 192 | asynch-buffer))) |
| 193 | 193 | ||
| 194 | (defun url-mm-callback (&rest ignored) | 194 | (defun url-mm-callback (&rest ignored) |