Emacs: Fix my/straight-check-last-update().

This commit is contained in:
tastytea 2020-03-26 01:21:53 +01:00
parent 070de22922
commit e7e4297adc

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-03-19T00:31:08+0100> ;; Time-stamp: <2020-03-26T01:21:25+0100>
;;; Commentary: ;;; Commentary:
;; * Set up straight ;; * Set up straight
@ -45,16 +45,18 @@
(straight-use-package 'use-package) (straight-use-package 'use-package)
(defun my/straight-check-last-update () (defun my/straight-check-last-update ()
"Notify if 7 days have passed since the MELPA repo was last updated." "Notify if 7 days have passed since the last package was built."
(let ((days 7)) (let ((days 7))
(when (> (- (time-to-seconds) (when (> (- (time-to-seconds)
(time-to-seconds (time-to-seconds (file-attribute-modification-time
(file-attribute-modification-time (file-attributes (straight--build-dir)))))
(file-attributes (expand-file-name "straight/repos/melpa"
user-emacs-directory)))))
(* 60 60 24 days)) (* 60 60 24 days))
(message "The last update was more than %d days ago." days)))) ;; Refresh repositories.
(add-hook 'after-init-hook #'my/straight-check-last-update) (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))))
(add-hook 'emacs-startup-hook #'my/straight-check-last-update)
;; ;; Autocompile files on load. ;; ;; Autocompile files on load.
;; (use-package auto-compile ;; (use-package auto-compile