Switch to curated package-selected-packages list

Not reverted to monolithic entry, but add to list where each
use-package declaration is for a given package. Replaces using
use-package :ensure for more reproducible package installations across
machines
This commit is contained in:
Evie Litherland-Smith 2024-08-07 21:59:32 +01:00
parent 49eda052a0
commit 7124e154aa

View file

@ -6,15 +6,6 @@ Personal Emacs configuration. Clone to =~/.config/emacs/= (or
=~/.emacs.d/=) and install specified plugins.
* Config
** Package management
Setup custom file
#+begin_src emacs-lisp
(setq custom-file (locate-user-emacs-file "custom.el"))
(when (and custom-file (file-exists-p custom-file))
(load custom-file nil 'nomessage))
#+end_src
Customise =use-package= before first time it's used.
#+begin_src emacs-lisp
@ -40,6 +31,7 @@ section of configuration.
#+begin_src emacs-lisp
(setq user-full-name "Evie Litherland-Smith"
user-mail-address "evie@xenia.me.uk"
custom-file (locate-user-emacs-file "custom.el")
use-short-answers t
kill-do-not-save-duplicates t)
@ -82,8 +74,9 @@ Configure the look and feel of Emacs
#+end_src
*** Theme and Icons
#+begin_src emacs-lisp
(add-to-list 'package-selected-packages 'base16-theme)
(use-package base16-theme
:ensure t
:if (package-installed-p 'base16-theme)
:defines (base16-one-light-theme-colors)
:custom
(base16-theme-distinct-fringe-background nil)
@ -114,29 +107,37 @@ Configure the look and feel of Emacs
(add-hook 'server-after-make-frame-hook
(lambda () (when (display-graphic-p) (my/load-theme-and-configure))))
(add-to-list 'package-selected-packages 'all-the-icons)
(add-to-list 'package-selected-packages 'all-the-icons-dired)
(add-to-list 'package-selected-packages 'all-the-icons-ibuffer)
(add-to-list 'package-selected-packages 'all-the-icons-completion)
(use-package all-the-icons
:ensure t)
:if (package-installed-p 'all-the-icons))
(use-package all-the-icons-dired
:ensure t
:if (package-installed-p 'all-the-icons-dired)
:after all-the-icons
:hook (dired-mode))
(use-package all-the-icons-ibuffer
:ensure t
:if (package-installed-p 'all-the-icons-ibuffer)
:after all-the-icons
:hook (ibuffer-mode))
(use-package all-the-icons-completion
:ensure t
:if (package-installed-p 'all-the-icons-completion)
:after (all-the-icons marginalia-mode)
:hook (marginalia-mode . all-the-icons-completion-marginalia-setup))
(add-to-list 'package-selected-packages 'nerd-icons)
(add-to-list 'package-selected-packages 'nerd-icons-corfu)
(use-package nerd-icons
:ensure t)
:if (package-installed-p 'nerd-icons))
(use-package nerd-icons-corfu
:ensure t
:if (package-installed-p 'nerd-icons-corfu)
:after nerd-icons)
#+end_src
*** Modeline
@ -146,8 +147,9 @@ Configure the look and feel of Emacs
(size-indication-mode +1)
(which-function-mode -1)
(add-to-list 'package-selected-packages 'doom-modeline)
(use-package doom-modeline
:ensure t
:if (package-installed-p 'doom-modeline)
:functions (doom-modeline-mode)
:hook (after-init . (lambda () (doom-modeline-mode +1)))
:custom
@ -180,7 +182,7 @@ Configure the look and feel of Emacs
*** Font ligatures
#+begin_src emacs-lisp
(use-package ligature
:ensure t
:if (package-installed-p 'ligature)
:disabled t
:functions (ligature-set-ligatures
global-ligature-mode)
@ -348,7 +350,6 @@ Configure email with iCalendar event support, to integrate with
(mm-discouraged-alternatives '("text/html")))
(use-package mu4e
:ensure nil
:if (package-installed-p 'mu4e)
:bind
(("C-c m" . mu4e)
@ -623,6 +624,11 @@ Configure email with iCalendar event support, to integrate with
#+end_src
*** IRC
** Other
** Load custom file
#+begin_src emacs-lisp
(when (and custom-file (file-exists-p custom-file))
(load custom-file nil 'nomessage))
#+end_src
** Initial copy from =init.el=
#+begin_src emacs-lisp
(use-package pixel-scroll
@ -693,8 +699,9 @@ Configure email with iCalendar event support, to integrate with
:custom
(flyspell-use-meta-tab nil))
(add-to-list 'package-selected-packages 'flyspell-correct)
(use-package flyspell-correct
:ensure t
:if (package-installed-p 'flyspell-correct)
:after flyspell
:bind ( :map flyspell-mode-map
("C-;" . flyspell-correct-wrapper)))
@ -725,8 +732,9 @@ Configure email with iCalendar event support, to integrate with
(add-hook 'prog-mode-hook #'(lambda () (display-line-numbers-mode +1)))
(add-to-list 'package-selected-packages 'which-key)
(use-package which-key
:ensure t
:if (package-installed-p 'which-key)
:functions which-key-mode
:config (which-key-mode +1))
@ -754,8 +762,9 @@ Configure email with iCalendar event support, to integrate with
cleanup
auto-cleanup)))
(add-to-list 'package-selected-packages 'diff-hl)
(use-package diff-hl
:ensure t
:if (package-installed-p 'diff-hl)
:functions (diff-hl-magit-pre-refresh
diff-hl-magit-post-refresh
global-diff-hl-mode)
@ -781,8 +790,9 @@ Configure email with iCalendar event support, to integrate with
:custom
(ediff-window-setup-function #'ediff-setup-windows-plain))
(add-to-list 'package-selected-packages 'emms)
(use-package emms
:ensure t
:if (package-installed-p 'emms)
:defines (emms-browser-mode-map
emms-playlist-mode-map)
:functions (emms-all
@ -929,8 +939,9 @@ Configure email with iCalendar event support, to integrate with
(when (or (package-installed-p 'emacsql-sqlite)
(package-installed-p 'emacsql-sqlite-builtin))
(add-to-list 'package-selected-packages 'org-roam)
(use-package org-roam
:ensure t
:if (package-installed-p 'org-roam)
:after org
:defines org-roam-directory
:functions org-roam-db-autosync-mode
@ -1020,7 +1031,7 @@ Configure email with iCalendar event support, to integrate with
(org-icalendar-combined-description "Emacs org-mode combined export"))
(use-package org-noter
:ensure t
:if (package-installed-p 'org-noter)
:disabled t
:after (org doc-view citar)
:commands org-noter
@ -1035,8 +1046,9 @@ Configure email with iCalendar event support, to integrate with
(car citar-notes-paths)))
(org-noter-prefer-root-as-file-level nil))
(add-to-list 'package-selected-packages 'citar)
(use-package citar
:ensure t
:if (package-installed-p 'citar)
:defines (citar-bibliography
citar-indicators)
:functions (citar-indicator-create
@ -1097,8 +1109,9 @@ Configure email with iCalendar event support, to integrate with
(setq org-latex-compiler "lualatex")
(setq org-preview-latex-default-process 'dvisvgm)
(add-to-list 'package-selected-packages 'vertico)
(use-package vertico
:ensure t
:if (package-installed-p 'vertico)
:functions vertico-mode
:hook (after-init . (lambda () (vertico-mode +1)))
:custom
@ -1106,8 +1119,9 @@ Configure email with iCalendar event support, to integrate with
:config
(require 'vertico-directory))
(add-to-list 'package-selected-packages 'marginalia)
(use-package marginalia
:ensure t
:if (package-installed-p 'marginalia)
:functions marginalia-mode
:hook (after-init . (lambda () (marginalia-mode +1)))
:custom
@ -1116,8 +1130,9 @@ Configure email with iCalendar event support, to integrate with
nil))
:config (marginalia-mode +1))
(add-to-list 'package-selected-packages 'orderless)
(use-package orderless
:ensure t
:if (package-installed-p 'orderless)
:custom
(completion-styles '(orderless basic))
(completion-category-defaults nil)
@ -1125,8 +1140,11 @@ Configure email with iCalendar event support, to integrate with
(eglot (styles orderless))
(eglot-capf (styles orderless)))))
(add-to-list 'package-selected-packages 'corfu)
(add-to-list 'package-selected-packages 'corfu-terminal)
(use-package corfu
:ensure t
:if (package-installed-p 'corfu)
:defines (corfu-map
corfu-mode-map
corfu-margin-formatters)
@ -1175,12 +1193,13 @@ Configure email with iCalendar event support, to integrate with
(corfu-popupinfo-delay 0.3))
(use-package corfu-terminal
:ensure t
:if (package-installed-p 'corfu-terminal)
:after corfu
:functions corfu-terminal-mode)
(add-to-list 'package-selected-packages 'cape)
(use-package cape
:ensure t
:if (package-installed-p 'cape)
:after corfu
:functions (cape-emoji
cape-file
@ -1193,8 +1212,11 @@ Configure email with iCalendar event support, to integrate with
:custom
(cape-dabbrev-min-length (+ corfu-auto-prefix 1)))
(add-to-list 'package-selected-packages 'consult)
(add-to-list 'package-selected-packages 'consult-eglot)
(use-package consult
:ensure t
:if (package-installed-p 'consult)
:functions (consult-org-heading
consult-history)
:bind (("<remap> <imenu>" . consult-imenu)
@ -1212,12 +1234,13 @@ Configure email with iCalendar event support, to integrate with
("<remap> <comint-history-isearch-backward-regexp>" . consult-history)))
(use-package consult-eglot
:ensure t
:if (package-installed-p 'consult-eglot)
:after (consult eglot)
:bind (("C-c s s" . consult-eglot-symbols)))
(add-to-list 'package-selected-packages 'tempel)
(use-package tempel
:ensure t
:if (package-installed-p 'tempel)
:defines tempel-path
:functions (tempel-expand
tempel-abbrev-mode)
@ -1247,12 +1270,14 @@ Configure email with iCalendar event support, to integrate with
;; :html-head "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/style.css\"/>"
)))
(add-to-list 'package-selected-packages 'rainbow-delimiters)
(use-package rainbow-delimiters
:ensure t
:if (package-installed-p 'rainbow-delimiters)
:hook (prog-mode))
(add-to-list 'package-selected-packages 'envrc)
(use-package envrc
:ensure t
:if (package-installed-p 'envrc)
:hook (after-init . envrc-global-mode)
:custom
(envrc-show-summary-in-minibuffer t))
@ -1267,8 +1292,9 @@ Configure email with iCalendar event support, to integrate with
:custom
(treesit-font-lock-level 3))
(add-to-list 'package-selected-packages 'treesit-auto)
(use-package treesit-auto
:ensure t
:if (package-installed-p 'treesit-auto)
:after treesit
:functions (treesit-auto-add-to-auto-mode-alist
global-treesit-auto-mode)
@ -1340,8 +1366,9 @@ Configure email with iCalendar event support, to integrate with
:yapf (:enabled nil)))))
)
(add-to-list 'package-selected-packages 'apheleia)
(use-package apheleia
:ensure t
:if (package-installed-p 'apheleia)
:defines (apheleia-formatters
apheleia-mode-alist)
:bind (("C-c c f" . apheleia-format-buffer))
@ -1359,8 +1386,11 @@ Configure email with iCalendar event support, to integrate with
(flymake-no-changes-timeout 1)
(flymake-show-diagnostics-at-end-of-line 'short))
(add-to-list 'package-selected-packages 'flymake-yamllint)
(add-to-list 'package-selected-packages 'flymake-eslint)
(use-package flymake-shellcheck
:ensure t
:if (package-installed-p 'flymake-shellcheck)
:disabled t
:functions flymake-shellcheck-load
:after flymake
@ -1368,14 +1398,14 @@ Configure email with iCalendar event support, to integrate with
(flymake-shellcheck-load)))))
(use-package flymake-yamllint
:ensure t
:if (package-installed-p 'flymake-yamllint)
:functions flymake-yamllint-setup
:after flymake
:hook (yaml-ts-mode . (lambda () (if (executable-find "yamllint" t)
(flymake-yamllint-setup)))))
(use-package flymake-clippy
:ensure t
:if (package-installed-p 'flymake-clippy)
:disabled t
:functions flymake-clippy-setup-backend
:after flymake
@ -1383,7 +1413,7 @@ Configure email with iCalendar event support, to integrate with
(flymake-clippy-setup-backend)))))
(use-package flymake-eslint
:ensure t
:if (package-installed-p 'flymake-eslint)
:functions flymake-eslint-enable
:after flymake
:hook ((js-base-mode typescript-ts-base-mode) . (lambda () (if (executable-find "eslint" t)
@ -1412,8 +1442,9 @@ Configure email with iCalendar event support, to integrate with
(project-remember-projects-under "~/Projects" t)
))
(add-to-list 'package-selected-packages 'magit)
(use-package magit
:ensure t
:if (package-installed-p 'magit)
:bind (("C-c g g" . magit-status)
("C-c g d" . magit-dispatch)
("C-c g f" . magit-file-dispatch)
@ -1437,13 +1468,15 @@ Configure email with iCalendar event support, to integrate with
("\\`\\(?:sourcehut:\\|sh:\\)\\([^:]+\\)\\'" "git.sr.ht" "sourcehut.user")
("\\`\\(?:gitea:\\|gt:\\)\\([^:]+\\)\\'" "git.xenia.me.uk" "gitea.user"))))
(add-to-list 'package-selected-packages 'forge)
(use-package forge
:ensure t
:if (package-installed-p 'forge)
:defer t)
(when (executable-find "nix")
(add-to-list 'package-selected-packages 'nix-mode)
(use-package nix-mode
:ensure t
:if (package-installed-p 'nix-mode)
:mode "\\.nix\\'"
:functions nix-prettify-global-mode
:config
@ -1453,8 +1486,9 @@ Configure email with iCalendar event support, to integrate with
(require 'nix-store)
(nix-prettify-global-mode +1)))
(add-to-list 'package-selected-packages 'lua-mode)
(use-package lua-mode
:ensure t
:if (package-installed-p 'lua-mode)
:mode "\\.lua\\'")
(defun my/enable-fill-column (col)
@ -1484,7 +1518,7 @@ Configure email with iCalendar event support, to integrate with
(setq python-ts-mode-hook python-mode-hook))
(use-package python-docstring
:ensure t
:if (package-installed-p 'python-docstring)
:disabled t
:hook python-base-mode)
@ -1522,8 +1556,9 @@ Configure email with iCalendar event support, to integrate with
(doc-view-scale-internally t)
(doc-view-image-width 850))
(add-to-list 'package-selected-packages 'markdown-mode)
(use-package markdown-mode
:ensure t
:if (package-installed-p 'markdown-mode)
:hook
((markdown-mode . turn-on-auto-fill))
:custom
@ -1536,13 +1571,15 @@ Configure email with iCalendar event support, to integrate with
(set-face-attribute 'markdown-blockquote-face nil :inherit 'variable-pitch)
(set-face-attribute 'markdown-comment-face nil :inherit 'variable-pitch))
(add-to-list 'package-selected-packages 'pandoc-mode)
(use-package pandoc-mode
:ensure t
:if (package-installed-p 'pandoc-mode)
:after (markdown-mode)
:hook (markdown-mode . conditionally-turn-on-pandoc))
(add-to-list 'package-selected-packages 'bbdb)
(use-package bbdb
:ensure t
:if (package-installed-p 'bbdb)
:bind (("M-g b" . bbdb-display-all-records))
:custom
(bbdb-file (locate-user-emacs-file "bbdb.gpg")))
@ -1582,13 +1619,15 @@ Configure email with iCalendar event support, to integrate with
(eww-auto-rename-buffer 'title)
(eww-browse-url-new-window-is-tab nil))
(add-to-list 'package-selected-packages 'password-store)
(use-package password-store
:ensure t
:if (package-installed-p 'password-store)
:defer t
:functions password-store-get)
(add-to-list 'package-selected-packages 'scad-mode)
(use-package scad-mode
:ensure t
:if (package-installed-p 'scad-mode)
:defer t)
;; Scratch buffer shortcut