;;; init.el --- Initialize my Emacs configuration ;;; Commentary: ;;; Code: (setq gc-cons-threshold 64000000) (add-hook 'after-init-hook #'(lambda () ;; restore after startup (setq gc-cons-threshold 800000))) (require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (defvar my/package-list '(chef-mode consult corfu dockerfile-mode eglot elfeed elfeed-org eshell-bookmark exec-path-from-shell git-commit git-link git-modes go-mode gotest hcl-mode jq-format magit marginalia markdown-mode nix-mode notmuch orderless protobuf-mode rg systemd terraform-doc terraform-mode use-package vertico which-key yaml-mode yasnippet) "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))) ;; run package installation (my/install-packages) (eval-when-compile (require 'use-package)) (setq use-package-verbose t) (setq use-package-always-ensure nil) (add-to-list 'load-path (expand-file-name "custom/" user-emacs-directory)) (add-to-list 'load-path (expand-file-name "elisp/" user-emacs-directory)) (require 'my-settings) (require 'my-ui) (require 'my-dired) (require 'my-navigation) (require 'my-completion) (require 'my-edit) (require 'my-text) (require 'my-git) (require 'my-org) (require 'my-conf) (require 'my-prog) (require 'my-eshell) (require 'my-tramp) (require 'my-notmuch) (require 'my-elfeed) (require 'my-buffers) (require 'my-git-extra) (require 'my-strings) (require 'my-web) (require 'my-work) (require 'my-packages-extra) ;;; init.el ends here