Emacs: Upgrade quelpa packages every 7 days.

This commit is contained in:
tastytea 2020-02-26 23:08:02 +01:00
parent 0a66771a5b
commit 980071fc5e

View File

@ -1,6 +1,6 @@
;;; package-management.el --- Initialize package management. -*- lexical-binding: t; -*- ;;; package-management.el --- Initialize package management. -*- lexical-binding: t; -*-
;; Time-stamp: <2020-02-24T22:03:02+0100> ;; Time-stamp: <2020-02-26T23:05:38+0100>
;;; Commentary: ;;; Commentary:
;; * Sets up package sources and their priorities. ;; * Sets up package sources and their priorities.
@ -10,6 +10,8 @@
;;; Code: ;;; Code:
(require 'basics/global-variables)
(require 'package) (require 'package)
(add-to-list 'package-archives (add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/") t) '("melpa-stable" . "https://stable.melpa.org/packages/") t)
@ -79,10 +81,25 @@
;; Install Emacs packages directly from source. ;; Install Emacs packages directly from source.
(use-package quelpa (use-package quelpa
:custom ((quelpa-upgrade-p t) :demand t
(quelpa-self-upgrade-p nil) :custom ((quelpa-self-upgrade-p nil)
(quelpa-update-melpa-p nil) (quelpa-update-melpa-p nil)
(quelpa-checkout-melpa-p nil)) (quelpa-checkout-melpa-p nil))
:config
(defvar my/quelpa-last-upgrade-file
(concat user-emacs-directory "quelpa/last_upgrade")
"File with the timestamp of the last quelpa upgrade.")
(defun my/quelpa-maybe-upgrade ()
"Upgrade quelpa packages if the last upgrade was > 7 days ago."
(when (or (not (file-exists-p my/quelpa-last-upgrade-file))
(> (- (time-to-seconds)
(my/file-last-modification my/quelpa-last-upgrade-file))
(* 60 60 24 7)))
(quelpa-upgrade-all)
(write-region "" nil my/quelpa-last-upgrade-file)))
:hook (after-init . my/quelpa-maybe-upgrade)
) )
(provide 'basics/package-management) (provide 'basics/package-management)