Emacs: quelpa-upgrade-all-maybe got merged.

This commit is contained in:
tastytea 2020-03-03 03:45:13 +01:00
parent 641af0e8d9
commit e3cddbac98
1 changed files with 4 additions and 17 deletions

View File

@ -1,6 +1,6 @@
;;; package-management.el --- Initialize package management. -*- lexical-binding: t; -*-
;; Time-stamp: <2020-02-27T05:36:25+0100>
;; Time-stamp: <2020-03-03T03:45:02+0100>
;;; Commentary:
;; * Set up package sources and their priorities.
@ -75,23 +75,10 @@
:demand t
:custom ((quelpa-self-upgrade-p nil)
(quelpa-update-melpa-p nil)
(quelpa-checkout-melpa-p nil))
:config
(defun my/quelpa-upgrade-all-maybe (&optional force)
"Run `quelpa-upgrade-all' if at least 7 days passed since the last run.
The prefix FORCE will be passed to `quelpa-upgrade-all'."
(interactive "P")
(let ((timestamp (expand-file-name "last_upgrade" quelpa-dir))
(days 7))
(when (or (not (file-exists-p timestamp))
(> (- (time-to-seconds) ; Current time - file modification time.
(time-to-seconds (nth 5 (file-attributes timestamp))))
(* 60 60 24 days)))
(let ((current-prefix-arg force))
(quelpa-upgrade-all))
(write-region "" nil timestamp))))
(quelpa-checkout-melpa-p nil)
(quelpa-upgrade-interval 7))
:hook (after-init . my/quelpa-upgrade-all-maybe)
:hook (after-init . quelpa-upgrade-all-maybe)
)
;; Use :quelpa in use-package configurations.