mirror of
https://github.com/jimeh/.emacs.d.git
synced 2026-02-19 13:46:41 +00:00
The core setup files for Emacs Siren which lives in the core directory followed a `siren-*.el` naming convention, which is the same as the naming convention for modules. This means that the `modules/core/siren-packages.el` module for adding packages for Emacs package development, was not being loaded due to it's name conflicting with `core/siren-packages.el` which sets up and configures the packaging system. So all files under the root `core` directory now follow a `siren-core-*.el` naming scheme, meaning modules should no longer conflict with core files.
75 lines
2.2 KiB
EmacsLisp
75 lines
2.2 KiB
EmacsLisp
;;; siren-core-packages.el --- jimeh's Emacs Siren: Core package setup
|
|
|
|
;;; Commentary:
|
|
|
|
;; Install and configure various packages that the core of Siren depends on.
|
|
|
|
;;; Code:
|
|
|
|
(require 'cl)
|
|
(require 'package)
|
|
|
|
;; Work-around bug in Emacs 26.2 preventing GNU ELPA to work over HTTPS.
|
|
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
|
|
|
|
(setq package-archives
|
|
'(("gnu" . "https://elpa.gnu.org/packages/")
|
|
("melpa-stable" . "https://stable.melpa.org/packages/")
|
|
("melpa" . "https://melpa.org/packages/"))
|
|
package-archive-priorities
|
|
'(("melpa" . 10)
|
|
("gnu" . 5)
|
|
("melpa-stable" . 0)))
|
|
|
|
;; set package-user-dir to be relative to config path
|
|
(setq package-user-dir (expand-file-name "elpa" siren-dir))
|
|
(package-initialize)
|
|
|
|
(defvar siren-packages
|
|
'(dash
|
|
diminish
|
|
exec-path-from-shell
|
|
smart-mode-line
|
|
use-package)
|
|
"A list of default packages to ensure are installed at launch.")
|
|
|
|
;;
|
|
;; Package helpers (borrowed from Emacs Prelude)
|
|
;;
|
|
|
|
(defun siren-packages-installed-p ()
|
|
"Check if all packages in `siren-packages' are installed."
|
|
(every #'package-installed-p siren-packages))
|
|
|
|
(defun siren-require-package (package)
|
|
"Install PACKAGE unless already installed."
|
|
(unless (memq package siren-packages)
|
|
(add-to-list 'siren-packages package))
|
|
(unless (package-installed-p package)
|
|
(package-install package)))
|
|
|
|
(defun siren-require-packages (packages)
|
|
"Ensure PACKAGES are installed.
|
|
Missing packages are installed automatically."
|
|
(mapc #'siren-require-package packages))
|
|
|
|
(defun siren-install-packages ()
|
|
"Install all packages listed in `siren-packages'."
|
|
(unless (siren-packages-installed-p)
|
|
;; check for new packages (package versions)
|
|
(message "%s" "Emacs is now refreshing its package database...")
|
|
(package-refresh-contents)
|
|
(message "%s" " done.")
|
|
;; install the missing packages
|
|
(siren-require-packages siren-packages)))
|
|
|
|
;; Install Melpa packages
|
|
(siren-install-packages)
|
|
|
|
;; Ensure use-package is loaded and configured
|
|
(require 'use-package)
|
|
(setq use-package-always-ensure t)
|
|
|
|
(provide 'siren-core-packages)
|
|
;;; siren-core-packages.el ends here
|