[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/with-url 5bd8812 4/8: Make :wait case actually wor
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] scratch/with-url 5bd8812 4/8: Make :wait case actually work. |
Date: |
Sun, 22 Jan 2017 00:29:33 +0000 (UTC) |
branch: scratch/with-url
commit 5bd88122094f7c8f25976e9a32772f213995b86f
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
Make :wait case actually work.
---
lisp/url/with-url.el | 37 ++++++++++++++++++++-----------------
1 file changed, 20 insertions(+), 17 deletions(-)
diff --git a/lisp/url/with-url.el b/lisp/url/with-url.el
index cce68bc..d3a75b6 100644
--- a/lisp/url/with-url.el
+++ b/lisp/url/with-url.el
@@ -171,13 +171,14 @@ and `base64'."
,(if wait
`(progn
(with-url--wait ,requestv)
- (let ((buffer (current-buffer)))
- (unwind-protect
- (when (or (not (url-request-ignore-errors req))
- (url-okp))
- (goto-char (point-min))
- ,@body)
- (kill-buffer buffer))))
+ (let ((buffer (process-buffer (url-request-process ,requestv))))
+ (with-current-buffer buffer
+ (unwind-protect
+ (when (or (not (url-request-ignore-errors ,requestv))
+ (url-okp))
+ (goto-char (point-min))
+ ,@body)
+ (kill-buffer buffer)))))
`(progn
(setf (url-request-callback ,requestv)
(lambda ()
@@ -285,9 +286,10 @@ If given, return the value in BUFFER instead."
(when (or (not (url-request-ignore-errors req))
(url-okp))
(goto-char (point-min))
- (unwind-protect
- (funcall (url-request-callback req))
- (kill-buffer buffer))))))
+ (when (url-request-callback req)
+ (unwind-protect
+ (funcall (url-request-callback req))
+ (kill-buffer buffer)))))))
(defun with-url--timer (req)
(let ((now (float-time)))
@@ -509,7 +511,6 @@ If given, return the value in BUFFER instead."
(with-url--callback process)))))
(defun with-url--callback (process &optional status)
- (message "Calling back")
(let ((req (plist-get (process-plist process) :request))
(buffer (process-buffer process)))
;; Pass the https certificate on to the caller.
@@ -547,9 +548,10 @@ If given, return the value in BUFFER instead."
(forward-char -1)
(delete-char -1)))
(goto-char (point-min))
- (unwind-protect
- (funcall (url-request-callback req))
- (kill-buffer buffer)))))
+ (when (url-request-callback req)
+ (unwind-protect
+ (funcall (url-request-callback req))
+ (kill-buffer buffer))))))
(defun with-url--decode-chunked ()
(let (length)
@@ -622,9 +624,10 @@ If given, return the value in BUFFER instead."
with-url--headers))
(defun with-url--wait (req)
- (with-url--fetch req)
- (while (not (url-request-finished req))
- (sleep-for 0.1)))
+ (prog1
+ (with-url--fetch req)
+ (while (not (url-request-finished req))
+ (sleep-for 0.1))))
(provide 'with-url)
- [Emacs-diffs] scratch/with-url updated (f74e07b -> 9d2e1e3), Lars Ingebrigtsen, 2017/01/21
- [Emacs-diffs] scratch/with-url dbc317f 2/8: Fix syntax error in with-url rework, Lars Ingebrigtsen, 2017/01/21
- [Emacs-diffs] scratch/with-url 5bd8812 4/8: Make :wait case actually work.,
Lars Ingebrigtsen <=
- [Emacs-diffs] scratch/with-url 495cb41 1/8: Handle the case where the peer drops connection with no Content-Length, Lars Ingebrigtsen, 2017/01/21
- [Emacs-diffs] scratch/with-url 3ee6d63 3/8: Rework for with-url, Lars Ingebrigtsen, 2017/01/21
- [Emacs-diffs] scratch/with-url 724b285 6/8: Always kill the buffer, even when ignoring errors, Lars Ingebrigtsen, 2017/01/21
- [Emacs-diffs] scratch/with-url be65731 7/8: Allow specifying that redirects should not be followed, Lars Ingebrigtsen, 2017/01/21
- [Emacs-diffs] scratch/with-url 8ff9bd5 5/8: Remove unused parameter, Lars Ingebrigtsen, 2017/01/21
- [Emacs-diffs] scratch/with-url 9d2e1e3 8/8: Increase timeouts not that progress is more ensured, Lars Ingebrigtsen, 2017/01/21