;;; my-packages.el --- List of packages to install -*- lexical-binding: t -*- ;; Author: Franck Cuny ;;; Commentary: ;;; Code: (require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (defvar my/package-list '(eglot ;; python blacken python-docstring python-mode ;; go go-mode gotest ;; nix nix-mode ;; rust rustic ;; various configuration formats chef-mode dockerfile-mode fish-mode hcl-mode jq-format protobuf-mode systemd terraform-doc terraform-mode toml-mode yaml-mode ;; git git-commit git-link git-modes magit ;; elfeed elfeed elfeed-org ;; org-mode org-cliplink ;; various text modes markdown-mode ;; tree-sitter tree-sitter tree-sitter-langs ;; navigation cape consult corfu marginalia orderless vertico which-key yasnippet ;; themes standard-themes ;; packages to interact with external tools exec-path-from-shell envrc rg) "List of packages to be installed.") (defun my/packages-installed-p () "Check if all packages in `my/package-list' are installed." (cl-every #'package-installed-p my/package-list)) (defun my/require-package (package) "Install PACKAGE unless already installed." (unless (memq package my/package-list) (add-to-list 'my/package-list package)) (unless (package-installed-p package) (package-install package))) (defun my/require-packages (packages) "Ensure PACKAGES are installed. Missing packages are installed automatically." (mapc #'my/require-package packages)) (defun my/install-packages () "Install all packages listed in `my/package-list'." (unless (my/packages-installed-p) ;; check for new packages (package versions) (message "%s" "Reloading packages DB...") (package-refresh-contents) (message "%s" " done.") ;; install the missing packages (my/require-packages my/package-list))) (provide 'my-packages) ;;; my-packages.el ends here