From 4f73327da10444275439d20ef68f4b218b1e26e4 Mon Sep 17 00:00:00 2001 From: Nicholas Rodrigues Lordello Date: Sat, 17 May 2025 19:05:29 +0200 Subject: Completely Refactor Emacs Configuration We now have a monolithic `init.el` instead of spliting it into files. I noticed that the splitting wasn't so helpful anyway... Maybe in the future when the config grows, I can think about splitting again (although, I will try to avoid that situation as much as possible). One large functional change is that I no longer try to fight Emacs to get it to put files in '~/.cache/emacs'. It was annoying, and it is just easier and more practical to just use a '.gitignore' in order to ignore any files other than my configuration (and since there are so few - two in fact - it is not a hard list to maintain). --- config/emacs/.gitignore | 10 ++ config/emacs/early-init.el | 22 ++-- config/emacs/flavours/development.el | 91 -------------- config/emacs/flavours/macos.el | 3 - config/emacs/init.el | 226 ++++++++++++++++++++++++++++++++--- 5 files changed, 226 insertions(+), 126 deletions(-) create mode 100644 config/emacs/.gitignore delete mode 100644 config/emacs/flavours/development.el delete mode 100644 config/emacs/flavours/macos.el diff --git a/config/emacs/.gitignore b/config/emacs/.gitignore new file mode 100644 index 0000000..c553df8 --- /dev/null +++ b/config/emacs/.gitignore @@ -0,0 +1,10 @@ +# Emacs tends to put **A LOT** of packages in the `emacs-user-directory` (i.e. +# `.emacs.d` or `~/.config/emacs`). At first, I tried to fight it by adding +# various configurations to put those files in `~/.cache/emacs` but decided that +# it was a Sisyphean task. Instead, we make `.gitignore` everything but the +# actual configuration files. + +* +!/.gitignore +!/early-init.el +!/init.el diff --git a/config/emacs/early-init.el b/config/emacs/early-init.el index fda615f..bf76d4b 100644 --- a/config/emacs/early-init.el +++ b/config/emacs/early-init.el @@ -1,19 +1,13 @@ -;;; -*- lexical-binding: t -*- +;;; early-init.el --- Emacs early initialization -*- lexical-binding: t -*- -;; Go VROOM-VROOM -(setq gc-cons-threshold 10000000) +;;; Commentary: -;; Setup the cache directory nice and early; we use it everywhere -(make-directory "~/.cache/emacs" t) +;; Early initialization configuration. Right now, it just increases +;; the `gc-cons-threshold' in order to speed up initialization. -;; Configure package.el directories -(setq - package-user-dir "~/.cache/emacs/elpa/" - package-gnupghome-dir "~/.cache/emacs/elpa/gnupg") +;;; Code: -;; Configure native-comp cache direactory -(when (boundp 'native-comp-eln-load-path) - (startup-redirect-eln-cache "~/.cache/emacs/eln-cache")) +(setq gc-cons-threshold 104857600) -;; Suppress native-comp warnings on startup -(setq warning-suppress-log-types '((comp) (bytecomp))) +(provide 'early-init) +;;; early-init.el ends here diff --git a/config/emacs/flavours/development.el b/config/emacs/flavours/development.el deleted file mode 100644 index 26ca23e..0000000 --- a/config/emacs/flavours/development.el +++ /dev/null @@ -1,91 +0,0 @@ -;;; -*- lexical-binding: t -*- - -;;; -;;; General -;;; - -(use-package copilot - :custom - (copilot-install-dir "~/.cache/emacs/copilot") - :bind (("C-" . copilot-accept-completion) - ("C-M-" . copilot-accept-completion-by-word) - ("C-c a a" . copilot-mode) - ("C-c a n" . copilot-next-completion) - ("C-c a p" . copilot-previous-completion))) - -(use-package eglot - :ensure nil - :bind - (:map eglot-mode-map - ("M-q" . eglot-format))) - -(use-package ligature - :hook - (prog-mode . ligature-mode) - :config - (ligature-set-ligatures - 'prog-mode - '(;; Group A - ".." ".=" "..." "..<" "::" ":::" ":=" "::=" ";;" ";;;" "??" "???" ".?" "?." - ":?" "?:" "?=" "**" "***" "/*" "*/" "/**" - ;; Group B - "<-" "->" "-<" ">-" "<--" "-->" "<<-" "->>" "-<<" ">>-" "<-<" ">->" "<-|" - "|->" "-|" "|-" "||-" "" "<<-" "->>" "-<<" ">>-" "<-<" ">->" "<-|" + "|->" "-|" "|-" "||-" "