aboutsummaryrefslogtreecommitdiff
path: root/piem-b4.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2021-05-23 17:46:20 -0400
committerKyle Meyer <kyle@kyleam.com>2021-05-23 17:47:53 -0400
commit715d7501fca8ffd7c18b0ecec8f1d8550690d15d (patch)
tree16e39ea928137ab96a7806dded8d41f67af8512a /piem-b4.el
parent8cc7c24db4b10bb31c8523a8ed0b6963b9b4fffa (diff)
downloadpiem-715d7501fca8ffd7c18b0ecec8f1d8550690d15d.tar.gz
Rework url-retrieve-synchronously wrapper
piem-download-and-decompress calls url-retrieve-synchronously, checks for a 200 status, and then manually removes the header. This works okay, but it'd be good for the error handling to match what's done by url-insert-file-contents. Introduce a new macro that largely copies what is done by url-insert-file-contents. The main difference is that url-insert is used instead of url-insert-buffer-contents so that the contents can be inserted literally. This approach is based on Emacs's 5f9671e57e (lisp/emacs-lisp/package.el: Fix decoding of downloaded files, 2019-05-18). Message-Id: <20210523214623.31331-3-kyle@kyleam.com>
Diffstat (limited to 'piem-b4.el')
-rw-r--r--piem-b4.el17
1 files changed, 8 insertions, 9 deletions
diff --git a/piem-b4.el b/piem-b4.el
index 48c8bf4..92ddea8 100644
--- a/piem-b4.el
+++ b/piem-b4.el
@@ -73,15 +73,14 @@ This is intended to be used for debugging purposes.")
;; back to b4's configuration.
(unless local-mbox-p
(when-let ((url (and (equal mid (piem-mid))
- (piem-inbox-get :url)))
- (buffer (condition-case nil
- (piem-download-and-decompress
- (concat url (piem-escape-mid mid) "/t.mbox.gz"))
- (error nil))))
- (with-current-buffer buffer
- (write-region nil nil mbox-thread))
- (kill-buffer buffer)
- (setq local-mbox-p t)))
+ (piem-check-gunzip)
+ (piem-inbox-get :url))))
+ (ignore-errors
+ (piem-with-url-contents
+ (concat url (piem-escape-mid mid) "/t.mbox.gz")
+ (piem-gunzip-buffer)
+ (write-region nil nil mbox-thread))
+ (setq local-mbox-p t))))
;; Move to the coderepo so that we pick up any b4 configuration
;; from there.
(condition-case err