core: add guards around package-refresh-contents redefinition
Authorize Spacemacs to redefine the function only for tested versions.
This commit is contained in:
parent
87b6d3fbe9
commit
7be61762ed
|
@ -11,6 +11,16 @@
|
|||
;;; License: GPLv3
|
||||
(require 'core-spacemacs-buffer)
|
||||
|
||||
;; Disclaimer:
|
||||
;; The code in this file is not meant to stay for ever, they are
|
||||
;; temporary fixes that we should remove as soon as a better
|
||||
;; solution is found.
|
||||
|
||||
;; TODO remove this code as soon as we have a clean alternative.
|
||||
;; A good proposal is available here:
|
||||
;; https://github.com/syl20bnr/spacemacs/commit/4d87ea626dafc066d911c83538e260dd2bef762f#commitcomment-14708731
|
||||
(when (and (version<= "24.3.1" emacs-version)
|
||||
(version<= emacs-version "24.5.1"))
|
||||
;; for some reason with-eval-after-load does not work here in 24.3
|
||||
;; maybe the backport is incorrect!
|
||||
(eval-after-load 'package
|
||||
|
@ -38,12 +48,13 @@ This redefinition adds a timeout of 5 seconds to contact each archive."
|
|||
(error (message "Cannot import default keyring: %S" (cdr error)))))))
|
||||
(dolist (archive package-archives)
|
||||
(condition-case-unless-debug nil
|
||||
;; add timeout here
|
||||
(with-timeout (5 (spacemacs-buffer/warning
|
||||
"Cannot contact archive %s (reason: timeout)"
|
||||
(cdr archive)))
|
||||
(package--download-one-archive archive "archive-contents"))
|
||||
(error (message "Failed to download `%s' archive."
|
||||
(car archive)))))
|
||||
(package-read-all-archive-contents))))
|
||||
(package-read-all-archive-contents)))))
|
||||
|
||||
(provide 'core-emacs-ext)
|
||||
|
|
Loading…
Reference in a new issue