From: Richard Stallman <rms@gnu.org>
To: Eduardo Ochs <eduardoochs@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: `url-retrieve-synchronously' is not synchronous enough
Date: Sun, 11 Nov 2007 00:22:10 -0500 [thread overview]
Message-ID: <E1Ir5Gs-0002SZ-HL@fencepost.gnu.org> (raw)
In-Reply-To: <87pryi7crj.fsf@gmail.com> (message from Eduardo Ochs on Sat, 10 Nov 2007 05:58:24 -0200)
`url-retrieve-synchronously' is not synchronous enough.
When I execute this sexp,
(progn (switch-to-buffer
(url-retrieve-synchronously "http://127.0.0.1/"))
(point))
the result is (point-max), but when I get the control back the
point is at the first character of a buffer - as if some hook
containing (goto-char (point-min)) ran after the (point) in the
progn.
I think I see the cause of this. In url-retrieve-synchronously:
(while (not retrieval-done)
(url-debug 'retrieval
"Spinning in url-retrieve-synchronously: %S (%S)"
retrieval-done asynch-buffer)
(if (buffer-local-value 'url-redirect-buffer asynch-buffer)
(setq proc (get-buffer-process
(setq asynch-buffer
(buffer-local-value 'url-redirect-buffer
asynch-buffer))))
(if (and proc (memq (process-status proc)
'(closed exit signal failed))
if the process terminated recently, process-status can update the
process status to `exit', or the connection status to `closed', but it
can't run the sentinel. That happens only when Emacs becomes idle.
Does this patch make it work?
*** url.el 25 Jul 2007 11:49:25 -0400 1.27.2.1
--- url.el 10 Nov 2007 19:58:50 -0500
***************
*** 240,246 ****
;; XXX: The callback must always be called. Any
;; exception is a bug that should be fixed, not worked
;; around.
! (setq retrieval-done t))
;; 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.
--- 240,248 ----
;; XXX: The callback must always be called. Any
;; exception is a bug that should be fixed, not worked
;; around.
! (progn ;; Call delete-process so we run any sentinel now.
! (delete-process proc)
! (setq retrieval-done t)))
;; 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.
next prev parent reply other threads:[~2007-11-11 5:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-10 7:58 `url-retrieve-synchronously' is not synchronous enough Eduardo Ochs
2007-11-11 5:22 ` Richard Stallman [this message]
2007-11-14 20:28 ` Eduardo Ochs
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=E1Ir5Gs-0002SZ-HL@fencepost.gnu.org \
--to=rms@gnu.org \
--cc=eduardoochs@gmail.com \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.