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

This commit is contained in:
tastytea 2020-03-30 00:22:28 +02:00
parent 8dda526768
commit db01e7d692

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-29T21:16:55+0200> ;; Time-stamp: <2020-03-30T00:21:50+0200>
;;; Commentary: ;;; Commentary:
;; * Set up straight ;; * Set up straight
@ -48,10 +48,11 @@
(defun my/straight-check-last-update () (defun my/straight-check-last-update ()
"Notify if 7 days have passed since the last package was built." "Notify if 7 days have passed since the last package was built."
(let ((days 7)) (let ((days 7)
(when (> (- (time-to-seconds) (mtime-seconds (time-to-seconds
(time-to-seconds (file-attribute-modification-time (file-attribute-modification-time
(file-attributes (straight--build-dir))))) (file-attributes (straight--build-dir))))))
(when (> (- (time-to-seconds) mtime-seconds)
(* 60 60 24 days)) (* 60 60 24 days))
(message "The last package update was more than %d days ago." days)))) (message "The last package update was more than %d days ago." days))))
(add-hook 'emacs-startup-hook #'my/straight-check-last-update) (add-hook 'emacs-startup-hook #'my/straight-check-last-update)