summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/package.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-11-15 21:28:37 +0000
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-11-15 21:32:47 +0000
commitd99ccd6dd171a12cf528c03a4a956ad1751173c5 (patch)
treeba3e79ee794cd6a875adce1560a553d7c692b332 /lisp/emacs-lisp/package.el
parenta6843cce90b5041adc456815ca0f7a3fdda6db1f (diff)
downloademacs-d99ccd6dd171a12cf528c03a4a956ad1751173c5.tar.gz
emacs-d99ccd6dd171a12cf528c03a4a956ad1751173c5.tar.bz2
emacs-d99ccd6dd171a12cf528c03a4a956ad1751173c5.zip
Backport: * lisp/emacs-lisp/package.el: Fix a decoding issue.
* lisp/url/url-handlers.el (url-insert-file-contents): Move some code to `url-insert-buffer-contents'. (url-insert-buffer-contents): New function (package--with-response-buffer): Use `url-insert-buffer-contents'. The previous code had some issues with decoding. Refactoring that function allows us to use the decoding from url-handlers while still treating both sync and async requests the same.
Diffstat (limited to 'lisp/emacs-lisp/package.el')
-rw-r--r--lisp/emacs-lisp/package.el16
1 files changed, 8 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index fba07a6801e..d811db9579f 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1165,16 +1165,16 @@ BODY (does not apply to errors signaled by ERROR-FORM).
(when-let ((er (plist-get status :error)))
(error "Error retrieving: %s %S" url er))
(unless (search-forward-regexp "^\r?\n\r?" nil 'noerror)
- (rest-error 'rest-unintelligible-result))
- (delete-region (point-min) (point))
- ,@body)
- (when (buffer-live-p b)
- (kill-buffer b)))))))
+ (error "Error retrieving: %s %S" url "incomprehensible buffer"))
+ (with-temp-buffer
+ (url-insert-buffer-contents b url)
+ (kill-buffer b)
+ (goto-char (point-min))
+ ,@body)))))))
(if ,async
(wrap-errors (url-retrieve url callback nil 'silent))
- (let ((buffer (wrap-errors (url-retrieve-synchronously url 'silent))))
- (with-current-buffer buffer
- (funcall callback nil)))))
+ (with-current-buffer (wrap-errors (url-retrieve-synchronously url 'silent))
+ (funcall callback nil))))
(wrap-errors (with-temp-buffer
(let ((url (expand-file-name ,file ,url-1)))
(unless (file-name-absolute-p url)