2020-03-18 12:14:30 +01:00
|
|
|
;;; package-management.el --- Initialize package management -*- lexical-binding: t; -*-
|
2019-10-14 17:38:14 +02:00
|
|
|
|
2020-03-18 15:00:17 +01:00
|
|
|
;; Time-stamp: <2020-03-18T14:51:33+0100>
|
2019-10-14 17:38:14 +02:00
|
|
|
|
|
|
|
;;; Commentary:
|
2020-03-18 12:14:30 +01:00
|
|
|
;; * Set up straight
|
2020-02-27 03:02:19 +01:00
|
|
|
;; * Set up use-package.
|
2019-10-14 17:38:14 +02:00
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2020-03-18 12:14:30 +01:00
|
|
|
;; Workaround for < 26.3 <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341>.
|
|
|
|
(when (and (< emacs-major-version 27)
|
|
|
|
(not (string= emacs-version "26.3")))
|
|
|
|
(defvar gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3"))
|
|
|
|
|
|
|
|
;; Define variables for straight.
|
2020-03-15 23:38:06 +01:00
|
|
|
(customize-set-variable
|
|
|
|
'straight-use-package-by-default t
|
|
|
|
"Makes use-package invoke straight.el to install the package.")
|
|
|
|
(customize-set-variable 'straight-cache-autoloads t
|
|
|
|
"Cache the autoloads of all packages in a single file.")
|
2020-03-18 13:07:08 +01:00
|
|
|
(customize-set-variable 'straight-vc-git-default-clone-depth 1
|
|
|
|
"Get shallow clones to save space.")
|
2020-03-15 23:38:06 +01:00
|
|
|
|
2020-03-18 12:14:30 +01:00
|
|
|
;; Bootstrap straight.
|
2020-03-15 23:38:06 +01:00
|
|
|
(defvar bootstrap-version)
|
|
|
|
(let ((bootstrap-file
|
2020-03-18 12:14:30 +01:00
|
|
|
(expand-file-name "straight/repos/straight.el/bootstrap.el"
|
|
|
|
user-emacs-directory))
|
2020-03-15 23:38:06 +01:00
|
|
|
(bootstrap-version 5))
|
|
|
|
(unless (file-exists-p bootstrap-file)
|
|
|
|
(with-current-buffer
|
|
|
|
(url-retrieve-synchronously
|
|
|
|
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
|
|
|
|
'silent 'inhibit-cookies)
|
|
|
|
(goto-char (point-max))
|
|
|
|
(eval-print-last-sexp)))
|
|
|
|
(load bootstrap-file nil 'nomessage))
|
|
|
|
|
2020-03-18 12:14:30 +01:00
|
|
|
(require 'straight) ; Shut up flycheck.
|
2019-10-14 17:38:14 +02:00
|
|
|
|
2020-03-18 12:14:30 +01:00
|
|
|
(add-hook 'after-init-hook #'straight-prune-build) ; Remove unnused packages.
|
2019-10-14 17:38:14 +02:00
|
|
|
|
2020-03-15 23:38:06 +01:00
|
|
|
;; Isolate package configurations.
|
|
|
|
(straight-use-package 'use-package)
|
|
|
|
|
2020-03-18 12:14:30 +01:00
|
|
|
(defun my/straight-check-last-update ()
|
2020-03-18 13:57:12 +01:00
|
|
|
"Notify if 7 days have passed since the MELPA repo was last updated."
|
2020-03-15 23:38:06 +01:00
|
|
|
(let ((days 7))
|
2020-03-18 12:14:30 +01:00
|
|
|
(when (> (- (time-to-seconds)
|
|
|
|
(time-to-seconds
|
|
|
|
(file-attribute-modification-time
|
2020-03-18 13:57:12 +01:00
|
|
|
(file-attributes (expand-file-name "straight/repos/melpa"
|
2020-03-18 12:14:30 +01:00
|
|
|
user-emacs-directory)))))
|
|
|
|
(* 60 60 24 days))
|
|
|
|
(message "The last update was more than %d days ago." days))))
|
|
|
|
(add-hook 'after-init-hook #'my/straight-check-last-update)
|
2020-03-15 23:38:06 +01:00
|
|
|
|
|
|
|
;; ;; Autocompile files on load.
|
|
|
|
;; (use-package auto-compile
|
|
|
|
;; :custom (load-prefer-newer t) ; Use uncompiled file if it is newer.
|
|
|
|
;; :config (auto-compile-on-load-mode))
|
2019-10-14 17:38:14 +02:00
|
|
|
|
|
|
|
(provide 'basics/package-management)
|
|
|
|
;;; package-management.el ends here
|