core: remove request.el dependency

This commit is contained in:
syl20bnr 2015-12-07 23:31:30 -05:00
parent 4a5ec73edf
commit 741bd0375f
3 changed files with 11 additions and 1353 deletions

View File

@ -19,7 +19,6 @@
(require 'package)
(require 'warnings)
(require 'ht)
(require 'request)
(require 'core-dotspacemacs)
(require 'core-funcs)
(require 'core-spacemacs-buffer)
@ -220,19 +219,17 @@ refreshed during the current session."
(car archive) i count) t))
(spacemacs//redisplay)
(setq i (1+ i))
(request (cdr archive) :sync t :type "GET"
:timeout configuration-layer--refresh-package-timeout
:error
(function* (lambda (&key error-thrown &allow-other-keys)
(configuration-layer//set-error)
(spacemacs-buffer/append
(format "\n%s: %s"
(car error-thrown)
(cdr error-thrown)))))
:status-code
'((200 . (lambda (&rest _)
(let ((package-archives (list archive)))
(package-refresh-contents)))))))
(unless (eq 'error (with-timeout
(dotspacemacs-elpa-timeout
(progn
(spacemacs-buffer/append
(format
"\nError while contacting %s repository!"
(car archive)))
'error))
(url-retrieve-synchronously (cdr archive))))
(let ((package-archives (list archive)))
(package-refresh-contents))))
(package-read-all-archive-contents)
(unless quiet (spacemacs-buffer/append "\n")))))

View File

@ -1,70 +0,0 @@
;;; request-deferred.el --- Wrap request.el by deferred
;; Copyright (C) 2012 Takafumi Arakaki
;; Author: Takafumi Arakaki <aka.tkf at gmail.com>
;; Package-Requires: ((deferred "0.3.1") (request "0.2.0"))
;; Version: 0.2.0
;; This file is NOT part of GNU Emacs.
;; request-deferred.el is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; request-deferred.el is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with request-deferred.el.
;; If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(require 'request)
(require 'deferred)
(defun request-deferred (url &rest args)
"Send a request and return deferred object associated with it.
Following deferred callback takes a response object regardless of
the response result. To make sure no error occurs during the
request, check `request-response-error-thrown'.
Arguments are the same as `request', but COMPLETE callback cannot
be used as it is used for starting deferred callback chain.
Example::
(require 'request-deferred)
(deferred:$
(request-deferred \"http://httpbin.org/get\" :parser 'json-read)
(deferred:nextc it
(lambda (response)
(message \"Got: %S\" (request-response-data response)))))
"
(let* ((d (deferred:new #'identity))
(callback-post (apply-partially
(lambda (d &rest args)
(deferred:callback-post
d (plist-get args :response)))
d)))
;; As `deferred:errorback-post' requires an error object to be
;; posted, use `deferred:callback-post' for success and error
;; cases.
(setq args (plist-put args :complete callback-post))
(apply #'request url args)
d))
(provide 'request-deferred)
;;; request-deferred.el ends here

File diff suppressed because it is too large Load Diff