From 6b81d47a878ab7b992f8f1b891490a50ab33c93c Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Sun, 11 Aug 2024 14:45:46 +0100 Subject: [PATCH] Revert to pre-straight config and Makefile Having issues with some packages with the straight version including built-in (e.g. eglot). Will continue tinkering with straight in a branch but back to package.el for now --- Makefile | 14 +-- README.org | 243 +++++++++++++++++++++++++++++--------------------- early-init.el | 1 - 3 files changed, 147 insertions(+), 111 deletions(-) delete mode 100644 early-init.el diff --git a/Makefile b/Makefile index 66d61b7..665f960 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,6 @@ -.PHONY: default init clean +.PHONY: default install -default: init +default: install -init: - git submodule update --init straight/repos/straight.el/ - -clean: - -rm straight/build-cache.el - -rm -rf straight/build - -rm -rf straight/repos - make init +install: + emacs --script install.el --kill diff --git a/README.org b/README.org index bfbb970..df0b822 100644 --- a/README.org +++ b/README.org @@ -2,25 +2,27 @@ #+author: Evie Litherland-Smith #+email: evie@xenia.me.uk #+filetags: :emacs:config:org: -Personal Emacs configuration. Clone to =~/.emacs.d/= and install -specified plugins. +Personal Emacs configuration. Clone to =~/.config/emacs/= (or +=~/.emacs.d/=) and install specified plugins. * Config ** Package management -Load [[https://github.com/radian-software/straight.el][straight.el]] functional package manager. Code stored in -[[file:straight/repos/straight.el/]] as a submodule, rather than using the -bootstrap script, for better reproducibility. Configure integration -with =use-package= and enable package installation with =straight.el= by -default. +Customise =use-package= before first time it's used. #+begin_src emacs-lisp - (defvar bootstrap-version) - (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) - (bootstrap-version 5)) - (when (file-exists-p bootstrap-file) - (load bootstrap-file nil 'nomessage))) + (setopt use-package-check-before-init t + use-package-enable-imenu-support t) +#+end_src - (require 'straight) - (straight-use-package 'use-package) +Configure package archives and initialise. + +#+begin_src emacs-lisp + (use-package package + :config + (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/")) + (package-initialize)) + + ;; Plugins that still need adding / configuring: `auctex' `htmlize' + ;; `password-store' #+end_src ** Defaults Set some useful defaults. Some of these should be moved to relevant @@ -38,13 +40,11 @@ section of configuration. (delete-selection-mode +1) #+end_src -Suppress compilation warnings since they're /usually/ just about -docstring sizes... +Filter warning messages from causing popups. Keep in log, but only +show for error or emergency. #+begin_src emacs-lisp - (require 'warnings) - (add-to-list 'warning-suppress-types '(comp)) - (add-to-list 'warning-suppress-log-types '(comp)) + (setq warning-minimum-level :error) #+end_src Bind mouse keys to expected movement commands @@ -74,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 - :straight t + :if (package-installed-p 'base16-theme) :defines (base16-one-light-theme-colors) :custom (base16-theme-distinct-fringe-background nil) @@ -106,26 +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 + :if (package-installed-p 'all-the-icons)) + + (use-package all-the-icons-dired + :if (package-installed-p 'all-the-icons-dired) + :after all-the-icons + :hook (dired-mode)) + + (use-package all-the-icons-ibuffer + :if (package-installed-p 'all-the-icons-ibuffer) + :after all-the-icons + :hook (ibuffer-mode)) + + (use-package all-the-icons-completion + :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 - :straight t) - - (use-package nerd-icons-dired - :straight t - :after (nerd-icons dired) - :hook (dired-mode . nerd-icons-dired-mode)) - - (use-package nerd-icons-ibuffer - :straight t - :after (nerd-icons ibuffer) - :hook (ibuffer-mode . nerd-icons-ibuffer-mode)) - - (use-package nerd-icons-completion - :straight t - :after (nerd-icons marginalia) - :hook (marginalia-mode . nerd-icons-completion-marginalia-setup)) + :if (package-installed-p 'nerd-icons)) (use-package nerd-icons-corfu - :straight t + :if (package-installed-p 'nerd-icons-corfu) :after nerd-icons) #+end_src *** Modeline @@ -135,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 - :straight t + :if (package-installed-p 'doom-modeline) :functions (doom-modeline-mode) :hook (after-init . (lambda () (doom-modeline-mode +1))) :custom @@ -169,9 +182,10 @@ Configure the look and feel of Emacs *** Font ligatures #+begin_src emacs-lisp (use-package ligature - :straight t - :functions (ligature-set-ligatures global-ligature-mode) - :hook (after-init . (lambda () (global-ligature-mode +1))) + :if (package-installed-p 'ligature) + :disabled t + :functions (ligature-set-ligatures + global-ligature-mode) :config (ligature-set-ligatures '(text-mode prog-mode org-mode) @@ -180,7 +194,8 @@ Configure the look and feel of Emacs "<->" "<-->" "<--->" "<---->" "<=>" "<==>" "<===>" "<====>" "<=" ">=" "==" "!=" "===" "!==" "!===" - "/*" "*/" "+++" "<~~" "~~>" ""))) + "/*" "*/" "+++" "<~~" "~~>" "")) + (global-ligature-mode +1)) #+end_src *** Font Showcase This is a showcase of various font and UI features to act as a @@ -684,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 - :straight t + :if (package-installed-p 'flyspell-correct) :after flyspell :bind ( :map flyspell-mode-map ("C-;" . flyspell-correct-wrapper))) @@ -716,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 - :straight t + :if (package-installed-p 'which-key) :functions which-key-mode :config (which-key-mode +1)) @@ -745,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 - :straight t + :if (package-installed-p 'diff-hl) :functions (diff-hl-magit-pre-refresh diff-hl-magit-post-refresh global-diff-hl-mode) @@ -772,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 - :straight t + :if (package-installed-p 'emms) :defines (emms-browser-mode-map emms-playlist-mode-map) :functions (emms-all @@ -812,7 +831,7 @@ Configure email with iCalendar event support, to integrate with (add-hook 'emms-player-started-hook #'emms-show)) (use-package org - :straight (:type built-in) + :demand :defines org-mode-map :hook ((org-mode . turn-on-auto-fill)) :bind ( :map org-mode-map @@ -866,7 +885,7 @@ Configure email with iCalendar event support, to integrate with (use-package org-indent :after org - :hook (org-mode . org-indent-mode)) + :hook org-mode) (use-package org-attach :after org @@ -920,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 - :straight t + :if (package-installed-p 'org-roam) :after org :defines org-roam-directory :functions org-roam-db-autosync-mode @@ -1011,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 - :straight t + :if (package-installed-p 'org-noter) :disabled t :after (org doc-view citar) :commands org-noter @@ -1026,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 - :straight t + :if (package-installed-p 'citar) :defines (citar-bibliography citar-indicators) :functions (citar-indicator-create @@ -1035,7 +1056,9 @@ Configure email with iCalendar event support, to integrate with citar-has-links citar-has-notes citar-is-cited) - :hook ((org-mode LaTeX-mode) . citar-capf-setup) + :hook + (LaTeX-mode . citar-capf-setup) + (org-mode . citar-capf-setup) :custom (citar-bibliography (list @@ -1048,7 +1071,7 @@ Configure email with iCalendar event support, to integrate with (expand-file-name "~/Documents/library/"))) :config (require 'org) - (require 'nerd-icons) + (require 'all-the-icons) (setopt org-cite-insert-processor 'citar org-cite-follow-processor 'citar org-cite-activate-processor 'citar) @@ -1056,36 +1079,25 @@ Configure email with iCalendar event support, to integrate with (add-to-list 'org-cite-global-bibliography bibfile)) (defvar citar-indicator-files-icons (citar-indicator-create - :symbol (nerd-icons-octicon - "nf-oct-file" - :face 'nerd-icons-green - :v-adjust -0.1) + :symbol (all-the-icons-octicon "file-pdf") :function #'citar-has-files :padding " " ; need this because the default padding is too low for these icons :tag "has:files")) (defvar citar-indicator-links-icons (citar-indicator-create - :symbol (nerd-icons-octicon - "nf-oct-link" - :face 'nerd-icons-orange - :v-adjust 0.01) + :symbol (all-the-icons-octicon "link") :function #'citar-has-links :padding " " ; need this because the default padding is too low for these icons :tag "has:links")) (defvar citar-indicator-notes-icons (citar-indicator-create - :symbol (nerd-icons-octicon - "nf-oct-note" - :face 'nerd-icons-blue - :v-adjust -0.3) + :symbol (all-the-icons-octicon "file-text") :function #'citar-has-notes :padding " " ; need this because the default padding is too low for these icons :tag "has:notes")) (defvar citar-indicator-cited-icons (citar-indicator-create - :symbol (nerd-icons-octicon - "nf-oct-circle" - :face 'nerd-icon-green) + :symbol (all-the-icons-octicon "file-binary") :function #'citar-is-cited :padding " " ; need this because the default padding is too low for these icons :tag "is:cited")) @@ -1097,15 +1109,19 @@ 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 - :straight t + :if (package-installed-p 'vertico) :functions vertico-mode :hook (after-init . (lambda () (vertico-mode +1))) :custom - (vertico-cycle t)) + (vertico-cycle t) + :config + (require 'vertico-directory)) + (add-to-list 'package-selected-packages 'marginalia) (use-package marginalia - :straight t + :if (package-installed-p 'marginalia) :functions marginalia-mode :hook (after-init . (lambda () (marginalia-mode +1))) :custom @@ -1114,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 - :straight t + :if (package-installed-p 'orderless) :custom (completion-styles '(orderless basic)) (completion-category-defaults nil) @@ -1123,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 - :straight t + :if (package-installed-p 'corfu) :defines (corfu-map corfu-mode-map corfu-margin-formatters) @@ -1173,12 +1193,13 @@ Configure email with iCalendar event support, to integrate with (corfu-popupinfo-delay 0.3)) (use-package corfu-terminal - :straight t + :if (package-installed-p 'corfu-terminal) :after corfu :functions corfu-terminal-mode) + (add-to-list 'package-selected-packages 'cape) (use-package cape - :straight t + :if (package-installed-p 'cape) :after corfu :functions (cape-emoji cape-file @@ -1191,9 +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 - :straight t + :if (package-installed-p 'consult) :functions (consult-org-heading consult-history) :bind ((" " . consult-imenu) @@ -1211,12 +1234,13 @@ Configure email with iCalendar event support, to integrate with (" " . consult-history))) (use-package consult-eglot - :straight 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 - :straight t + :if (package-installed-p 'tempel) :defines tempel-path :functions (tempel-expand tempel-abbrev-mode) @@ -1246,12 +1270,14 @@ Configure email with iCalendar event support, to integrate with ;; :html-head "" ))) + (add-to-list 'package-selected-packages 'rainbow-delimiters) (use-package rainbow-delimiters - :straight t - :hook (after-init . rainbow-delimiters-mode)) + :if (package-installed-p 'rainbow-delimiters) + :hook (prog-mode)) + (add-to-list 'package-selected-packages 'envrc) (use-package envrc - :straight t + :if (package-installed-p 'envrc) :hook (after-init . envrc-global-mode) :custom (envrc-show-summary-in-minibuffer t)) @@ -1266,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 - :straight t + :if (package-installed-p 'treesit-auto) :after treesit :functions (treesit-auto-add-to-auto-mode-alist global-treesit-auto-mode) @@ -1339,12 +1366,13 @@ Configure email with iCalendar event support, to integrate with :yapf (:enabled nil))))) ) + (add-to-list 'package-selected-packages 'apheleia) (use-package apheleia - :straight t + :if (package-installed-p 'apheleia) :defines (apheleia-formatters apheleia-mode-alist) :bind (("C-c c f" . apheleia-format-buffer)) - :hook (prog-mode . apheleia-mode) + :hook (prog-mode) :custom (apheleia-remote-algorithm 'cancel) :config (add-to-list 'apheleia-mode-alist '(python-ts-mode . (ruff ruff-isort))) @@ -1358,30 +1386,34 @@ 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 - :straight t + :if (package-installed-p 'flymake-shellcheck) + :disabled t :functions flymake-shellcheck-load :after flymake :hook (sh-mode . (lambda () (if (executable-find "shellcheck" t) (flymake-shellcheck-load))))) (use-package flymake-yamllint - :straight 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 - :straight t + :if (package-installed-p 'flymake-clippy) + :disabled t :functions flymake-clippy-setup-backend :after flymake :hook (rust-mode . (lambda () (if (executable-find "clippy" t) (flymake-clippy-setup-backend))))) (use-package flymake-eslint - :straight 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) @@ -1410,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 - :straight 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 +1470,15 @@ 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 'forge) (use-package forge - :straight t + :if (package-installed-p 'forge) :defer t)) (when (executable-find "nix") + (add-to-list 'package-selected-packages 'nix-mode) (use-package nix-mode - :straight t + :if (package-installed-p 'nix-mode) :mode "\\.nix\\'" :functions nix-prettify-global-mode :config @@ -1453,8 +1488,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 - :straight t + :if (package-installed-p 'lua-mode) :mode "\\.lua\\'") (defun my/enable-fill-column (col) @@ -1484,8 +1520,9 @@ Configure email with iCalendar event support, to integrate with (setq python-ts-mode-hook python-mode-hook)) (use-package python-docstring - :straight t - :hook (python-base-mode . python-docstring-mode)) + :if (package-installed-p 'python-docstring) + :disabled t + :hook python-base-mode) (use-package files :custom @@ -1521,9 +1558,11 @@ 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 - :straight t - :hook ((markdown-mode . turn-on-auto-fill)) + :if (package-installed-p 'markdown-mode) + :hook + ((markdown-mode . turn-on-auto-fill)) :custom (markdown-enable-math t) (markdown-enable-html t) @@ -1534,13 +1573,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 - :straight 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 - :straight t + :if (package-installed-p 'bbdb) :bind (("M-g b" . bbdb-display-all-records)) :custom (bbdb-file (locate-user-emacs-file "bbdb.gpg"))) @@ -1580,13 +1621,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 - :straight 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 - :straight t + :if (package-installed-p 'scad-mode) :defer t) ;; Scratch buffer shortcut diff --git a/early-init.el b/early-init.el deleted file mode 100644 index 512068a..0000000 --- a/early-init.el +++ /dev/null @@ -1 +0,0 @@ -(setq package-enable-at-startup nil)