Clear out some packages I don't need any more

Removed: page-break-lines, helpful, ace-window, link-hint,
consult-flyspell, embark (and associated), forge (part of magit
anyway), flymake-popon, aggressive-indent

Add function to ensure selected packages are installed

Remove associated config for removed packages

Move sendmail and message package config into mu4e module

Reformat without aggressive-indent mode on
This commit is contained in:
Evie Litherland-Smith 2024-07-22 10:38:11 +01:00
parent c0ba4c15ca
commit b1112170f4
2 changed files with 63 additions and 138 deletions

156
init.el
View file

@ -1,12 +1,7 @@
;;; init.el -- My emacs config -*- lexical-binding: t -*- ;;; init.el -- My emacs config -*- lexical-binding: t -*-
;;; Commentary: ;;; Commentary:
;; Moving my Emacs config from separate directory
;; To install packages on non-NixOS systems run `install.el'
;;; Code: ;;; Code:
;; Stop popups for warning messages, keep in log buffer
(setopt warning-minimum-level :error)
;; Customise `use-package' behaviour, must be set before first time ;; Customise `use-package' behaviour, must be set before first time
;; it's used. Configure packages archives with priority ;; it's used. Configure packages archives with priority
(setopt use-package-check-before-init t (setopt use-package-check-before-init t
@ -21,24 +16,32 @@
:custom :custom
(package-archive-priorities '(("melpa" . 1) ("stable" . 2) ("nongnu" . 3) ("gnu" . 4))) (package-archive-priorities '(("melpa" . 1) ("stable" . 2) ("nongnu" . 3) ("gnu" . 4)))
(package-selected-packages (package-selected-packages
'(;; Theme '(
base16-theme
;; UI ;; UI
all-the-icons nerd-icons nerd-icons-completion nerd-icons-corfu nerd-icons-dired nerd-icons-ibuffer base16-theme all-the-icons nerd-icons nerd-icons-completion
minions ligature page-break-lines helpful which-key ace-window link-hint diff-hl nerd-icons-corfu nerd-icons-dired nerd-icons-ibuffer minions
ligature which-key diff-hl
;; Completion ;; Completion
vertico orderless marginalia cape corfu corfu-terminal vertico orderless marginalia cape corfu corfu-terminal
consult consult-eglot consult-flyspell embark embark-consult consult consult-eglot flyspell-correct tempel
flyspell-correct tempel
;; IDE ;; IDE
treesit-auto magit forge flymake-popon flymake-shellcheck flymake-yamllint flymake-clippy flymake-eslint treesit-auto magit apheleia envrc rainbow-delimiters
apheleia envrc rainbow-delimiters aggressive-indent python-docstring nix-mode lua-mode flymake-shellcheck flymake-yamllint flymake-clippy flymake-eslint
;; Writing markdown-mode pandoc-mode python-docstring nix-mode lua-mode
markdown-mode pandoc-mode auctex htmlize))
))
:config :config
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives '("stable" . "https://stable.melpa.org/packages/")) (add-to-list 'package-archives '("stable" . "https://stable.melpa.org/packages/"))
(package-initialize)) (package-initialize)
(defun my/package-ensure ()
"Update package archives and ensure packages are installed."
(package-refresh-contents)
(package-install-selected-packages)
(package-autoremove)))
(set-default-coding-systems 'utf-8) (set-default-coding-systems 'utf-8)
@ -120,19 +123,6 @@
:config :config
(auth-source-pass-enable)) (auth-source-pass-enable))
;; Make `describe-*' screens more helpful
(use-package helpful
:if (package-installed-p 'helpful)
:defines helpful-mode-map
:bind (("<remap> <describe-command>" . helpful-command)
("<remap> <describe-function>" . helpful-callable)
("<remap> <describe-key>" . helpful-key)
("<remap> <describe-symbol>" . helpful-symbol)
("<remap> <describe-variable>" . helpful-variable)
("C-h F" . helpful-function)
:map helpful-mode-map
("<remap> <revert-buffer>" . helpful-update)))
;; Bind extra `describe-*' commands ;; Bind extra `describe-*' commands
(keymap-global-set "C-h K" #'describe-keymap) (keymap-global-set "C-h K" #'describe-keymap)
@ -156,39 +146,10 @@
:bind ( :map flyspell-mode-map :bind ( :map flyspell-mode-map
("C-;" . flyspell-correct-wrapper))) ("C-;" . flyspell-correct-wrapper)))
(use-package consult-flyspell
:after (consult flyspell)
:bind ( :map flyspell-mode-map
("C-c s ;" . consult-flyspell))
:custom
(consult-flyspell-always-check-buffer t))
(use-package ibuffer (use-package ibuffer
:defines ibuffer-filter-groups :defines ibuffer-filter-groups
:bind (("C-c b" . ibuffer))) :bind (("C-c b" . ibuffer)))
(use-package avy
:if (package-installed-p 'avy)
:bind (("<remap> <goto-char>" . avy-goto-char)))
(use-package ace-window
:if (package-installed-p 'ace-window)
:bind (("<remap> <other-window>" . ace-window))
:custom
(aw-scope 'frame)
(aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)))
(use-package link-hint
:if (package-installed-p 'link-hint)
:bind (("C-c l o" . link-hint-open-link)
("C-c l c" . link-hint-copy-link)
("C-c l C-o" . link-hint-open-all-link)
("C-c l C-c" . link-hint-copy-all-link)))
(use-package comint
:bind ( :map comint-mode-map
("<remap> <comint-history-isearch-backward-regexp>" . consult-history)))
(use-package shell (use-package shell
:bind (("C-c t s" . shell))) :bind (("C-c t s" . shell)))
@ -690,14 +651,6 @@
citar-indicator-notes-icons citar-indicator-notes-icons
citar-indicator-cited-icons))) citar-indicator-cited-icons)))
(use-package citar-embark
:requires citar
:functions citar-embark-mode
:init
(require 'embark)
:config
(citar-embark-mode +1))
(setq org-latex-compiler "lualatex") (setq org-latex-compiler "lualatex")
(setq org-preview-latex-default-process 'dvisvgm) (setq org-preview-latex-default-process 'dvisvgm)
@ -814,24 +767,14 @@
("C-c s e" . consult-flymake) ("C-c s e" . consult-flymake)
("C-c s i" . consult-info) ("C-c s i" . consult-info)
:map minibuffer-local-map :map minibuffer-local-map
("<remap> <previous-matching-history-element>" . consult-history))) ("<remap> <previous-matching-history-element>" . consult-history)
:map comint-mode-map
("<remap> <comint-history-isearch-backward-regexp>" . consult-history)))
(use-package consult-eglot (use-package consult-eglot
:after (consult eglot) :after (consult eglot)
:bind (("C-c s s" . consult-eglot-symbols))) :bind (("C-c s s" . consult-eglot-symbols)))
(use-package embark
:if (package-installed-p 'embark)
:functions embark-prefix-help-command
:bind (("<remap> <describe-bindings>" . embark-bindings)
("C-." . embark-act))
:config
(setq prefix-help-command #'embark-prefix-help-command))
(use-package embark-consult
:after (embark consult)
:hook (embark-collect-mode . consult-preview-at-point-mode))
(use-package tempel (use-package tempel
:if (package-installed-p 'tempel) :if (package-installed-p 'tempel)
:defines tempel-path :defines tempel-path
@ -995,38 +938,33 @@
(flymake-no-changes-timeout 1) (flymake-no-changes-timeout 1)
(flymake-show-diagnostics-at-end-of-line 'short)) (flymake-show-diagnostics-at-end-of-line 'short))
(use-package flymake-popon
:if (package-installed-p 'flymake-popon)
:functions flymake-popon-mode
:requires flymake
:hook ((flymake-mode . (lambda () (flymake-popon-mode +1)))))
(use-package flymake-shellcheck (use-package flymake-shellcheck
:if (and (executable-find "shellcheck") :if (package-installed-p 'flymake-shellcheck)
(package-installed-p 'flymake-shellcheck)) :functions flymake-shellcheck-load
:requires flymake :requires flymake
:hook (sh-mode . flymake-shellcheck-load)) :hook (sh-mode . (lambda () (if (executable-find "shellcheck" t)
(flymake-shellcheck-load)))))
(use-package flymake-yamllint (use-package flymake-yamllint
:if (and (executable-find "yamllint") :if (package-installed-p 'flymake-yamllint)
(package-installed-p 'flymake-yamllint))
:functions flymake-yamllint-setup :functions flymake-yamllint-setup
:requires flymake :requires flymake
:hook (yaml-ts-mode . flymake-yamllint-setup)) :hook (yaml-ts-mode . (lambda () (if (executable-find "yamllint" t)
(flymake-yamllint-setup)))))
(use-package flymake-clippy (use-package flymake-clippy
:if (and (executable-find "clippy") :if (package-installed-p 'flymake-clippy)
(package-installed-p 'flymake-clippy))
:functions flymake-clippy-setup-backend :functions flymake-clippy-setup-backend
:requires flymake :requires flymake
:hook (rust-mode . flymake-clippy-setup-backend)) :hook (rust-mode . (lambda () (if (executable-find "clippy" t)
(flymake-clippy-setup-backend)))))
(use-package flymake-eslint (use-package flymake-eslint
:if (and (executable-find "eslint") :if (package-installed-p 'flymake-eslint)
(package-installed-p 'flymake-eslint))
:functions flymake-eslint-enable :functions flymake-eslint-enable
:requires flymake :requires flymake
:hook ((js-base-mode typescript-ts-base-mode) . flymake-eslint-enable)) :hook ((js-base-mode typescript-ts-base-mode) . (lambda () (if (executable-find "eslint" t)
(flymake-eslint-enable)))))
(use-package project (use-package project
:functions (project-forget-zombie-projects :functions (project-forget-zombie-projects
@ -1076,13 +1014,6 @@ Calls `project-remember-projects-under' for ~/Projects/"
("\\`\\(?:sourcehut:\\|sh:\\)\\([^:]+\\)\\'" "git.sr.ht" "sourcehut.user") ("\\`\\(?:sourcehut:\\|sh:\\)\\([^:]+\\)\\'" "git.sr.ht" "sourcehut.user")
("\\`\\(?:gitea:\\|gt:\\)\\([^:]+\\)\\'" "git.xenia.me.uk" "gitea.user")))) ("\\`\\(?:gitea:\\|gt:\\)\\([^:]+\\)\\'" "git.xenia.me.uk" "gitea.user"))))
(use-package aggressive-indent
:if (package-installed-p 'aggressive-indent)
:hook (elisp-mode
lisp-mode
lisp-data-mode
rust-mode))
(use-package nix-mode (use-package nix-mode
:if (package-installed-p 'nix-mode) :if (package-installed-p 'nix-mode)
:mode "\\.nix\\'" :mode "\\.nix\\'"
@ -1170,27 +1101,14 @@ Calls `project-remember-projects-under' for ~/Projects/"
:after (markdown-mode) :after (markdown-mode)
:hook (markdown-mode . conditionally-turn-on-pandoc)) :hook (markdown-mode . conditionally-turn-on-pandoc))
(use-package sendmail (if (package-installed-p 'mu4e)
:custom (load-file (locate-user-emacs-file "modules/my-mu4e.el")))
(sendmail-program (executable-find "msmtp"))
(send-mail-function #'sendmail-send-it))
(use-package message
:custom
(message-send-mail-function #'message-send-mail-with-sendmail)
(message-sendmail-f-is-evil t)
(message-sendmail-extra-arguments '("--read-envelope-from"))
(message-auto-save-directory nil)
(message-kill-buffer-on-exit t))
(use-package bbdb (use-package bbdb
:bind (("M-g b" . bbdb-display-all-records)) :bind (("M-g b" . bbdb-display-all-records))
:custom :custom
(bbdb-file (locate-user-emacs-file "bbdb.gpg"))) (bbdb-file (locate-user-emacs-file "bbdb.gpg")))
(if (package-installed-p 'mu4e)
(load-file (locate-user-emacs-file "modules/my-mu4e.el")))
(use-package erc (use-package erc
:commands erc-compute-nick :commands erc-compute-nick
:custom :custom

View file

@ -1,14 +1,21 @@
;;; my-mu4e.el -- mu4e -*- lexical-binding: t -*- ;;; my-mu4e.el -- mu4e -*- lexical-binding: t -*-
;;; Commentary: ;;; Commentary:
;;; Code: ;;; Code:
(setq sendmail-program (executable-find "msmtp")
send-mail-function #'sendmail-send-it (use-package sendmail
message-send-mail-function #'message-send-mail-with-sendmail :custom
message-sendmail-f-is-evil t (sendmail-program (executable-find "msmtp"))
message-sendmail-extra-arguments '("--read-envelope-from") (send-mail-function #'sendmail-send-it))
message-auto-save-directory nil
message-kill-buffer-on-exit t (use-package message
mail-user-agent 'mu4e-user-agent :custom
(message-send-mail-function #'message-send-mail-with-sendmail)
(message-sendmail-f-is-evil t)
(message-sendmail-extra-arguments '("--read-envelope-from"))
(message-auto-save-directory nil)
(message-kill-buffer-on-exit t))
(setq mail-user-agent 'mu4e-user-agent
read-mail-command 'mu4e) read-mail-command 'mu4e)
(use-package mm-decode (use-package mm-decode