Emacs: Automatically update recipe repositories.

This commit is contained in:
tastytea 2020-07-04 15:45:43 +02:00
parent 0d60abb631
commit 7be019efdd
1 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,6 @@
;;; package-management.el --- Initialize package management -*- lexical-binding: t; -*-
;; Time-stamp: <2020-05-24T22:15:31+0200>
;; Time-stamp: <2020-07-04T15:45:08+0200>
;;; Commentary:
;; * Set up straight
@ -52,14 +52,16 @@
(customize-set-variable 'use-package-always-defer t)
(defun my/straight-check-last-update ()
"Notify if 7 days have passed since the last package was built."
"Update recipe repositories after 7 days have passed since the last package was built."
(let ((days 7)
(mtime-seconds (time-to-seconds
(file-attribute-modification-time
(file-attributes (straight--build-dir))))))
(when (> (- (time-to-seconds) mtime-seconds)
(* 60 60 24 days))
(message "The last package update was more than %d days ago." days))))
(dolist (package ; straight-recipe-repositories
'("org-elpa" "melpa" "gnu-elpa-mirror" "emacsmirror-mirror"))
(straight-pull-package package)))))
(add-hook 'emacs-startup-hook #'my/straight-check-last-update)
(defun my/straight-update-repos ()