Emacs: Add my/straight-update-repos.

This commit is contained in:
tastytea 2020-11-18 18:10:59 +01:00
parent c2175d42af
commit bf54968d65
1 changed files with 17 additions and 11 deletions

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-11-10T22:28:36+0100> ;; Time-stamp: <2020-11-18T18:09:44+0100>
;;; Commentary: ;;; Commentary:
;; * Set up straight ;; * Set up straight
@ -50,16 +50,22 @@
(require 'use-package) (require 'use-package)
(use-package straight (use-package straight
:config (defun my/straight-check-last-update () :config (progn
"Update recipe repositories after 7 days have passed since the last package was built." (defun my/straight-update-repos ()
(let ((days 7) "Update recipe repositories."
(mtime-seconds (time-to-seconds (interactive)
(file-attribute-modification-time (dolist (package straight-recipe-repositories)
(file-attributes (straight--build-dir)))))) (straight-pull-package package)))
(when (> (- (time-to-seconds) mtime-seconds)
(* 60 60 24 days)) (defun my/straight-check-last-update ()
(dolist (package straight-recipe-repositories) "Update recipe repositories after 7 days have passed since the last package was built."
(straight-pull-package package))))) (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))
(my/straight-update-repos)))))
:hook ((emacs-startup . my/straight-check-last-update) :hook ((emacs-startup . my/straight-check-last-update)
((after-init . straight-prune-build)))) ((after-init . straight-prune-build))))