Fix package-refresh-contents loop bug in package management
This commit is contained in:
parent
a0ae976555
commit
e1518e2d27
1 changed files with 10 additions and 4 deletions
|
@ -1,15 +1,21 @@
|
||||||
;;; packages.el
|
;;; packages.el
|
||||||
(provide 'doom-lib-packages)
|
(provide 'doom-lib-packages)
|
||||||
|
|
||||||
|
(defvar doom--last-refresh nil)
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-refresh-packages ()
|
(defun doom-refresh-packages ()
|
||||||
"Refresh ELPA packages."
|
"Refresh ELPA packages."
|
||||||
(doom-initialize)
|
(doom-initialize)
|
||||||
(let ((last-refresh (persistent-soft-fetch 'last-pkg-refresh "emacs")))
|
(let ((last-refresh (persistent-soft-fetch 'last-pkg-refresh "emacs")))
|
||||||
(when (or (not last-refresh)
|
(when last-refresh
|
||||||
(> (nth 1 (time-since last-refresh)) 600))
|
(setq doom--last-refresh last-refresh)))
|
||||||
|
(when (or (not doom--last-refresh)
|
||||||
|
(> (nth 1 (time-since doom--last-refresh)) 600))
|
||||||
(package-refresh-contents)
|
(package-refresh-contents)
|
||||||
(persistent-soft-store 'last-pkg-refresh (current-time) "emacs"))))
|
(persistent-soft-store
|
||||||
|
'last-pkg-refresh (setq doom--last-refresh (current-time))
|
||||||
|
"emacs")))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-package-backend (name)
|
(defun doom-package-backend (name)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue