From bf54968d656a0702e0683df18b6498c66aac81ca Mon Sep 17 00:00:00 2001 From: tastytea Date: Wed, 18 Nov 2020 18:10:59 +0100 Subject: [PATCH] Emacs: Add my/straight-update-repos. --- init.d/basics/package-management.el | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/init.d/basics/package-management.el b/init.d/basics/package-management.el index 07b310c..108fe56 100644 --- a/init.d/basics/package-management.el +++ b/init.d/basics/package-management.el @@ -1,6 +1,6 @@ ;;; 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: ;; * Set up straight @@ -50,16 +50,22 @@ (require 'use-package) (use-package straight - :config (defun my/straight-check-last-update () - "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)) - (dolist (package straight-recipe-repositories) - (straight-pull-package package))))) + :config (progn + (defun my/straight-update-repos () + "Update recipe repositories." + (interactive) + (dolist (package straight-recipe-repositories) + (straight-pull-package package))) + + (defun my/straight-check-last-update () + "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)) + (my/straight-update-repos))))) :hook ((emacs-startup . my/straight-check-last-update) ((after-init . straight-prune-build))))