doom-refresh-packages: caches refresh time in file
This commit is contained in:
parent
07b38ac36c
commit
25962a6beb
1 changed files with 9 additions and 4 deletions
|
@ -8,10 +8,15 @@
|
||||||
(defun doom-refresh-packages ()
|
(defun doom-refresh-packages ()
|
||||||
"Refresh ELPA packages."
|
"Refresh ELPA packages."
|
||||||
(doom-initialize)
|
(doom-initialize)
|
||||||
(when (or (not doom-packages-last-refresh)
|
(let ((refresh-cache (f-expand "last-pkg-refresh" doom-cache-dir)))
|
||||||
(> (nth 1 (time-since doom-packages-last-refresh)) 3600))
|
(when (and (not doom-packages-last-refresh)
|
||||||
(package-refresh-contents)
|
(f-exists-p refresh-cache))
|
||||||
(setq doom-packages-last-refresh (current-time))))
|
(setq doom-packages-last-refresh (read (f-read refresh-cache))))
|
||||||
|
(when (or (not doom-packages-last-refresh)
|
||||||
|
(> (nth 1 (time-since doom-packages-last-refresh)) 600))
|
||||||
|
(package-refresh-contents)
|
||||||
|
(setq doom-packages-last-refresh (current-time))
|
||||||
|
(f-write (pp-to-string doom-packages-last-refresh) 'utf-8 refresh-cache))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-package-backend (name)
|
(defun doom-package-backend (name)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue