diff --git a/init.d/basics/package-management.el b/init.d/basics/package-management.el index 1892b49..07b310c 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-07-04T15:45:08+0200> +;; Time-stamp: <2020-11-10T22:28:36+0100> ;;; Commentary: ;; * Set up straight @@ -42,34 +42,26 @@ (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) - -(require 'straight) ; Shut up flycheck. - -(add-hook 'after-init-hook #'straight-prune-build) ; Remove unnused packages. +(require 'straight) ;; Isolate package configurations. (straight-use-package 'use-package) (customize-set-variable 'use-package-always-defer t) +(require 'use-package) -(defun my/straight-check-last-update () - "Update recipe repositories after 7 days have passed since the last package was built." - (let ((days 7) - (mtime-seconds (time-to-seconds - (file-attribute-modification-time - (file-attributes (straight--build-dir)))))) - (when (> (- (time-to-seconds) mtime-seconds) - (* 60 60 24 days)) - (dolist (package ; straight-recipe-repositories - '("org-elpa" "melpa" "gnu-elpa-mirror" "emacsmirror-mirror")) - (straight-pull-package package))))) -(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)) +(use-package straight + :config (defun my/straight-check-last-update () + "Update recipe repositories after 7 days have passed since the last package was built." + (let ((days 7) + (mtime-seconds (time-to-seconds + (file-attribute-modification-time + (file-attributes (straight--build-dir)))))) + (when (> (- (time-to-seconds) mtime-seconds) + (* 60 60 24 days)) + (dolist (package straight-recipe-repositories) + (straight-pull-package package))))) + :hook ((emacs-startup . my/straight-check-last-update) + ((after-init . straight-prune-build)))) (provide 'basics/package-management) ;;; package-management.el ends here