[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/with-url bc505fd 1/8: Fix up some :wait issues
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] scratch/with-url bc505fd 1/8: Fix up some :wait issues |
Date: |
Sun, 22 Jan 2017 22:25:22 +0000 (UTC) |
branch: scratch/with-url
commit bc505fd29277a3e2fd4b0e2b83b1c0ee16a67791
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
Fix up some :wait issues
---
lisp/url/with-url.el | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/lisp/url/with-url.el b/lisp/url/with-url.el
index 1f47b4f..a38f0f3 100644
--- a/lisp/url/with-url.el
+++ b/lisp/url/with-url.el
@@ -155,7 +155,8 @@ When using the posting methods, the data is usually encoded
in
some fashion. Supported encodings are `url-form', `multipart'
and `base64'."
(declare (indent 1))
- (let ((requestv (cl-gensym "request")))
+ (let ((requestv (cl-gensym "request"))
+ (buffer (cl-gensym "buffer")))
`(let ((,requestv
(make-url-request :original-url ,url
:timeout ,timeout
@@ -177,15 +178,15 @@ and `base64'."
,(if wait
`(progn
(with-url--wait ,requestv)
- (let ((buffer (process-buffer (url-request-process ,requestv))))
- (with-current-buffer buffer
+ (let ((,buffer (url-request-buffer ,requestv)))
+ (with-current-buffer ,buffer
(unwind-protect
(if (and (url-request-ignore-errors ,requestv)
(url-errorp))
(kill-buffer buffer)
(goto-char (point-min))
,@body)
- (kill-buffer buffer)))))
+ (kill-buffer ,buffer)))))
`(progn
(setf (url-request-callback ,requestv)
(lambda ()
@@ -251,6 +252,7 @@ If given, return the value in BUFFER instead."
(with-url--parse-headers)
(goto-char (point-min))
(delete-region (point) (search-forward "\n\n"))
+ (setf (url-request-finished req) t)
(with-url--possible-callback req))
;; If not, fetch it from the web.
(let* ((coding-system-for-read 'binary)
@@ -741,6 +743,9 @@ If the headers don't allow caching, nothing will be done."
(narrow-to-region (point) (or (search-forward "\n\n" nil t) (point)))
(mail-fetch-field "last-modified")))))
+(defun with-url-cached-p (url)
+ (file-exists-p (with-url--cache-file-name url)))
+
(defun with-url-get-cache (url)
(let ((file (with-url--cache-file-name url)))
(when (file-exists-p file)
- [Emacs-diffs] scratch/with-url updated (3322f8f -> 03b56ca), Lars Ingebrigtsen, 2017/01/22
- [Emacs-diffs] scratch/with-url f402e35 3/8: Heed the Cache-Control header, Lars Ingebrigtsen, 2017/01/22
- [Emacs-diffs] scratch/with-url 3733456 2/8: Adapt to the new cache, Lars Ingebrigtsen, 2017/01/22
- [Emacs-diffs] scratch/with-url 1c59f8a 6/8: Get chunked decoding right, Lars Ingebrigtsen, 2017/01/22
- [Emacs-diffs] scratch/with-url 4fb09fd 4/8: Build fix, Lars Ingebrigtsen, 2017/01/22
- [Emacs-diffs] scratch/with-url bc505fd 1/8: Fix up some :wait issues,
Lars Ingebrigtsen <=
- [Emacs-diffs] scratch/with-url b6d6172 7/8: Don't move point around when inserting images, Lars Ingebrigtsen, 2017/01/22
- [Emacs-diffs] scratch/with-url 2415aae 5/8: Make reloading work again., Lars Ingebrigtsen, 2017/01/22
- [Emacs-diffs] scratch/with-url 03b56ca 8/8: Respect the buffer parameter, Lars Ingebrigtsen, 2017/01/22