From e6391e1ff920e785de1c279edf967afb4d6539bc Mon Sep 17 00:00:00 2001 From: tastytea Date: Sun, 29 Mar 2020 21:17:22 +0200 Subject: [PATCH] Emacs: Don't update repos automatically. --- init.d/basics/package-management.el | 31 ++++++++++++----------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/init.d/basics/package-management.el b/init.d/basics/package-management.el index bdf03cd..ce018e9 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-03-27T00:26:50+0100> +;; Time-stamp: <2020-03-29T21:16:55+0200> ;;; Commentary: ;; * Set up straight @@ -49,25 +49,20 @@ (defun my/straight-check-last-update () "Notify if 7 days have passed since the last package was built." (let ((days 7)) - (cl-flet ((file-old? - (lambda (file) - "Return t if FILE was modified more than DAYS ago." - (if (> (- (time-to-seconds) - (time-to-seconds (file-attribute-modification-time - (file-attributes file)))) - (* 60 60 24 days)) - t - nil)))) - (when (file-old? (straight--build-dir)) - ;; Update repositories if newest MELPA recipe is older than DAYS. - (when (file-old? - (expand-file-name "melpa/recipes" (straight--repos-dir))) - (straight-pull-package 'melpa) - (straight-pull-package 'gnu-elpa-mirror) - (straight-pull-package 'emacsmirror-mirror)) - (message "The last package update was more than %d days ago." days))))) + (when (> (- (time-to-seconds) + (time-to-seconds (file-attribute-modification-time + (file-attributes (straight--build-dir))))) + (* 60 60 24 days)) + (message "The last package update was more than %d days ago." days)))) (add-hook 'emacs-startup-hook #'my/straight-check-last-update) +(defun my/straight-update-repos () + "Update MELPA, ELPA and Emacsmirror." + (interactive) + (straight-pull-package 'melpa) + (straight-pull-package 'gnu-elpa-mirror) + (straight-pull-package 'emacsmirror-mirror)) + ;; ;; Autocompile files on load. ;; (use-package auto-compile ;; :custom (load-prefer-newer t) ; Use uncompiled file if it is newer.