From f44c767eeaf1f8ddec53ce1e2c38d84feae0ee1a Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Thu, 15 Feb 2024 08:18:41 +0000 Subject: [PATCH] Break up monolithic config into smaller files Contents of README.org have been split into org files in config/ directory Added init.el to simply loop over config files and call org-babel-load-file Add lots to .gitignore as this repo should now be cloned to .emacs.d (instead of .emacs as before) --- .gitignore | 19 +- README.org | 1494 +------------------------------------------ config/crafted.org | 172 +++++ config/defaults.org | 244 +++++++ config/ide.org | 402 ++++++++++++ config/internet.org | 317 +++++++++ config/media.org | 39 ++ config/org-mode.org | 226 +++++++ config/pass.org | 25 + config/tramp.org | 39 ++ config/ui.org | 207 ++++++ config/writing.org | 18 + crafted_config.el | 173 ----- init.el | 24 + 14 files changed, 1734 insertions(+), 1665 deletions(-) create mode 100644 config/crafted.org create mode 100644 config/defaults.org create mode 100644 config/ide.org create mode 100644 config/internet.org create mode 100644 config/media.org create mode 100644 config/org-mode.org create mode 100644 config/pass.org create mode 100644 config/tramp.org create mode 100644 config/ui.org create mode 100644 config/writing.org delete mode 100644 crafted_config.el create mode 100644 init.el diff --git a/.gitignore b/.gitignore index 9f8f56e..8594f46 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,18 @@ -/README.el +/config/*.el +/.org-id-locations +/auto-save-list/ +/bookmarks +/custom.el +/eln-cache/ +/elpa/ +/emms/ +/eshell/ +/forge-database.sqlite +/games/ +/history +/org-roam.db +/projects +/recentf +/tramp +/transient/ +/url/ diff --git a/README.org b/README.org index 91d5df8..de39c16 100644 --- a/README.org +++ b/README.org @@ -2,1495 +2,7 @@ #+author: Evie Litherland-Smith #+email: evie@xenia.me.uk #+filetags: :emacs:config:org: -#+property: header-args:emacs-lisp :tangle yes :mkdirp yes :results output silent +Personal Emacs config. -* Setup -Loading this file is handled automatically on my [[https://git.xenia.me.uk/xenia/nixos/src/branch/main/home/emacs.nix][NixOS config]], otherwise add ~(org-babel-load-file "~/.emacs/README.org")~ to init file. - -* Common defaults -#+begin_src emacs-lisp :results output silent - (setq custom-file (locate-user-emacs-file "custom.el")) - (when (and custom-file (file-exists-p custom-file)) - (load custom-file nil 'nomessage)) - - (setq user-full-name "Evie Litherland-Smith" - user-mail-address "evie@xenia.me.uk" - use-short-answers t - load-prefer-newer t - indent-tabs-mode nil - even-window-sizes t - global-auto-revert-non-file-buffers t - dired-auto-revert-buffer t - dired-dwim-target t - tab-always-indent t - completion-cycle-threshold nil - completions-detailed t - xref-show-definitions-function #'xref-show-definitions-completing-read - kill-do-not-save-duplicates t - auto-window-vscroll nil - fast-but-imprecise-scrolling t - scroll-conservatively 101 - scroll-margin 0 - scroll-preserve-screen-position 1) - - ;; Config file shortcut - (defun my/open-config-file () - "Open my literate config file" - (interactive) - (find-file "~/.emacs/README.org")) - (keymap-global-set "C-c w c" #'my/open-config-file) - - - ;; Scratch buffer shortcut - (keymap-global-set "C-c w x" #'scratch-buffer) - - ;; Bind normal forward/back buttons on mouse to next/previous buffer respectively - (keymap-global-set "" #'previous-buffer) - (keymap-global-set "" #'next-buffer) - - (set-default-coding-systems 'utf-8) - (set-terminal-coding-system 'utf-8) - (set-keyboard-coding-system 'utf-8) - - (global-auto-revert-mode +1) - (delete-selection-mode +1) - - ;; No tabs - (customize-set-variable 'indent-tabs-mode nil) - - ;; Only display async output buffer when there's something to show - (customize-set-variable 'async-shell-command-display-buffer nil) - - ;; Make shebang (#!) file executable when saved - (add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) - - ;; Scroll compilation buffer output - (customize-set-variable 'compilation-scroll-output t) -#+end_src - -** Auto-save file settings -#+begin_src emacs-lisp :tangle yes - (setq backup-directory-alist '(("." . "~/.local/state/emacs/backups")) - tramp-backup-directory-alist backup-directory-alist - tramp-auto-save-directory (cdr (assoc "." tramp-backup-directory-alist))) - - (savehist-mode +1) -#+end_src - -** Recent files -#+begin_src emacs-lisp - (use-package recentf - :config - (run-at-time nil (* 5 60) 'recentf-save-list) - (recentf-mode +1) - :custom - (recentf-max-saved-items 2048)) -#+end_src - -** package-archive with priorities -#+begin_src emacs-lisp :results output silent - (when (require 'package nil :noerror) - (add-to-list 'package-archives '("stable" . "https://stable.melpa.org/packages/")) - (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) - - (setq package-archive-priorities '(("gnu" . 99) - ("nongnu" . 80) - ("stable" . 70) - ("melpa" . 0)))) -#+end_src -** diminish modes -#+begin_src emacs-lisp - (use-package diminish :ensure t) -#+end_src - -** Authentication -#+begin_src emacs-lisp - (when (require 'auth-source nil :noerror) - (setq auth-sources '("secrets:Login")) - (when (require 'auth-source-pass nil :noerror) - (auth-source-pass-enable))) -#+end_src - -** Helpful -#+begin_src emacs-lisp - ;; Make `describe-*' screens more helpful - (use-package helpful - :ensure t - :bind ((" " . helpful-command) - (" " . helpful-callable) - (" " . helpful-key) - (" " . helpful-symbol) - (" " . helpful-variable) - ("C-h F" . helpful-function) - :map helpful-mode-map - (" " . helpful-update))) - - ;; Bind extra `describe-*' commands - (keymap-global-set "C-h K" #'describe-keymap) -#+end_src - -** Spell checking -#+begin_src emacs-lisp - ;; turn on spell checking, if available. - (when (and (require 'ispell nil :noerror) (executable-find ispell-program-name)) - (use-package flyspell - :ensure t - :diminish - :hook ((text-mode . flyspell-mode) - (prog-mode . flyspell-prog-mode)) - :custom - (flyspell-mode-line-string nil) - (flyspell-use-meta-tab nil)) - (use-package flyspell-correct - :ensure t - :diminish - :after flyspell - :bind ( :map flyspell-mode-map - ("C-;" . flyspell-correct-wrapper))) - (use-package consult-flyspell - :ensure t - :diminish - :after (consult flyspell) - :bind ( :map flyspell-mode-map - ("C-c s ;" . consult-flyspell)) - :config - (setq consult-flyspell-always-check-buffer t))) -#+end_src - -** ibuffer -#+begin_src emacs-lisp - (use-package ibuffer - :ensure t - :bind (("C-c b" . ibuffer))) - - (use-package ibuffer-project - :ensure t - :after ibuffer - :hook ((ibuffer . (lambda () - (setq ibuffer-filter-groups (ibuffer-project-generate-filter-groups)) - (unless (eq ibuffer-sorting-mode 'project-file-relative) - (ibuffer-do-sort-by-project-file-relative)))))) -#+end_src - -** whitespace-mode -#+begin_src emacs-lisp - (use-package whitespace - :custom - (whitespace-action '(report-on-bogus - cleanup - warn-if-read-only)) - (whitespace-style '(face - trailing - tabs - spaces - lines-tail - newline - missing-newline-at-eof - empty - indentation - big-indent - space-after-tab - space-before-tab - space-mark - tab-mark - newline-mark))) -#+end_src - -** Link hint keymaps -#+begin_src emacs-lisp - (use-package link-hint - :ensure t - :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))) -#+end_src - -** Avy keymaps -#+begin_src emacs-lisp - (use-package avy - :ensure t - :diminish - :bind (("C-c j j" . avy-goto-char-2) - ("C-c j w" . avy-goto-word-0) - ("C-c j c" . avy-goto-char) - ("C-c j l" . avy-goto-line))) -#+end_src - -** which-func config -#+begin_src emacs-lisp - (use-package which-func - :ensure t - :init (which-function-mode)) -#+end_src - -** Shells and terminals -#+begin_src emacs-lisp - (use-package shell - :bind (("C-c t s" . shell))) - - (use-package eshell - :bind (("C-c t e" . eshell))) -#+end_src - -** Web browser -#+begin_src emacs-lisp :tangle yes - (use-package eww - :defer t - :diminish - :custom - (browse-url-browser-function 'browse-url-default-browser) - (browse-url-new-window-flag t) - (eww-default-download-directory "~/Downloads/") - (eww-auto-rename-buffer 'title) - (eww-browse-url-new-window-is-tab nil)) - - -#+end_src -* UI -#+begin_src emacs-lisp - (setq use-dialog-box nil - truncate-lines nil - truncate-partial-width-windows nil) - - (menu-bar-mode +1) - (global-prettify-symbols-mode +1) - (global-display-line-numbers-mode -1) - (tool-bar-mode -1) - - (add-hook 'prog-mode-hook #'(lambda () (display-line-numbers-mode +1))) - - (with-eval-after-load 'diminish - (diminish 'visual-line-mode)) - (global-visual-line-mode +1) - - (use-package which-key - :ensure t - :diminish - :config (which-key-mode +1)) - - (use-package page-break-lines - :ensure t - :diminish - :config (global-page-break-lines-mode +1)) - - ;; add visual pulse when changing focus, like beacon but built-in - ;; from from https://karthinks.com/software/batteries-included-with-emacs/ - (defun pulse-line (&rest _) - "Pulse the current line." - (pulse-momentary-highlight-one-line (point))) - - (dolist (command '(scroll-up-command - scroll-down-command - recenter-top-bottom - other-window)) - (advice-add command :after #'pulse-line)) -#+end_src - -** Theme, font and nerd-icons -#+begin_src emacs-lisp - (add-to-list 'initial-frame-alist '(width . 120)) - (add-to-list 'initial-frame-alist '(height . 80)) - - ;; Theme - (use-package modus-themes - :ensure t - :custom - (modus-themes-disable-other-themes t) - (modus-themes-to-toggle '(modus-operandi-tinted modus-vivendi-tinted)) - (modus-themes-bold-constructs t) - (modus-themes-italic-constructs t) - (modus-themes-org-blocks nil) - (modus-themes-completions '((matches . (extrabold underline)) - (selection . (semibold italic)))) - (modus-themes-headings '((1 . (1.4)) - (2 . (1.3)) - (3 . (1.2)) - (agenda-date . (1.3)) - (agenda-structure . (light 1.8)) - (t . (1.1)))) - :config - (modus-themes-load-theme 'modus-vivendi-tinted)) - - ;; Nerd-Icons modes - (use-package nerd-icons - :ensure t - :diminish - :config (nerd-icons-set-font "Symbols Nerd Font Mono-12")) - - (use-package nerd-icons-dired - :ensure t - :after nerd-icons - :diminish - :hook (dired-mode)) - - (use-package nerd-icons-ibuffer - :ensure t - :after nerd-icons - :diminish - :hook (ibuffer-mode)) - - (use-package nerd-icons-completion - :ensure t - :after nerd-icons - :diminish - :config (nerd-icons-completion-mode +1)) - - (use-package nerd-icons-corfu - :ensure t - :after (corfu nerd-icons) - :diminish - :config (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter)) - - (keymap-global-set "C-c i n" #'nerd-icons-insert) -#+end_src - -*** Font ligatures -#+begin_src emacs-lisp - (use-package ligature - :ensure t - :diminish - :config - (ligature-set-ligatures - '(text-mode prog-mode org-mode) - '("<--" "<---" "<<-" "<-" "->" "->>" "-->" "--->" - "<==" "<===" "<<=" "<=" "=>" "=>>" "==>" "===>" - "<->" "<-->" "<--->" "<---->" "<=>" "<==>" "<===>" "<====>" "::" ":::" - "<~~" "" "/>" "~~>" "==" "!=" "<>" "===" "!==" "!===" - "<:" ":=" "*=" "*+" "<*" "<*>" "*>" "<|" "<|>" "|>" "+*" "=*" "=:" ":>" - "/*" "*/" "+++" "" "--->" + "<==" "<===" "<<=" "<=" "=>" "=>>" "==>" "===>" + "<->" "<-->" "<--->" "<---->" "<=>" "<==>" "<===>" "<====>" "::" ":::" + "<~~" "" "/>" "~~>" "==" "!=" "<>" "===" "!==" "!===" + "<:" ":=" "*=" "*+" "<*" "<*>" "*>" "<|" "<|>" "|>" "+*" "=*" "=:" ":>" + "/*" "*/" "+++" "