Emacs: Don't update repos automatically.
This commit is contained in:
parent
beb126d0e1
commit
e6391e1ff9
|
@ -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-27T00:26:50+0100>
|
;; Time-stamp: <2020-03-29T21:16:55+0200>
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;; * Set up straight
|
;; * Set up straight
|
||||||
|
@ -49,25 +49,20 @@
|
||||||
(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))
|
||||||
(cl-flet ((file-old?
|
(when (> (- (time-to-seconds)
|
||||||
(lambda (file)
|
(time-to-seconds (file-attribute-modification-time
|
||||||
"Return t if FILE was modified more than DAYS ago."
|
(file-attributes (straight--build-dir)))))
|
||||||
(if (> (- (time-to-seconds)
|
(* 60 60 24 days))
|
||||||
(time-to-seconds (file-attribute-modification-time
|
(message "The last package update was more than %d days ago." days))))
|
||||||
(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)))))
|
|
||||||
(add-hook 'emacs-startup-hook #'my/straight-check-last-update)
|
(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.
|
;; ;; Autocompile files on load.
|
||||||
;; (use-package auto-compile
|
;; (use-package auto-compile
|
||||||
;; :custom (load-prefer-newer t) ; Use uncompiled file if it is newer.
|
;; :custom (load-prefer-newer t) ; Use uncompiled file if it is newer.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user