Emacs: Don't update repos automatically.

This commit is contained in:
tastytea 2020-03-29 21:17:22 +02:00
parent beb126d0e1
commit e6391e1ff9
1 changed files with 13 additions and 18 deletions

View File

@ -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.