#+title: Emacs Config #+author: Evie Litherland-Smith #+email: evie@xenia.me.uk #+property: header-args:emacs-lisp :results silent Personal Emacs configuration. Clone to =~/.config/emacs/= (or =~/.emacs.d/=) and install specified plugins using [[file:install.el][the install script]]. * Config ** Package management Customise =use-package= before first time it's used. #+begin_src emacs-lisp (setopt use-package-check-before-init t use-package-enable-imenu-support t) #+end_src 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)) (defun my/package-ensure-installed () "Ensure packages in `package-selected-packages' are installed." (interactive) (require 'package) (package-autoremove) (package-upgrade-all nil) (package-install-selected-packages t)) #+end_src ** Delight for minor-modes Install =delight= to hide certain minor-modes from modeline #+begin_src emacs-lisp (add-to-list 'package-selected-packages 'delight) (use-package delight :demand t :if (package-installed-p 'delight)) #+end_src ** Defaults Set some useful defaults. Some of these should be moved to relevant 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) (set-language-environment "UTF-8") (set-default-coding-systems 'utf-8) (global-auto-revert-mode +1) (delete-selection-mode +1) #+end_src Filter warning messages from causing popups. Keep in log, but only show for error or emergency. #+begin_src emacs-lisp (setq warning-minimum-level :error) #+end_src Bind mouse keys to expected movement commands #+begin_src emacs-lisp (keymap-global-set "" #'previous-buffer) (keymap-global-set "" #'next-buffer) #+end_src ** UI and Appearance Configure the look and feel of Emacs #+begin_src emacs-lisp (setq inhibit-splash-screen t initial-frame-alist nil default-frame-alist nil) (setq-default truncate-lines t truncate-partial-width-windows nil) (setopt indent-tabs-mode nil async-shell-command-display-buffer nil compilation-scroll-output t) (set-window-scroll-bars (minibuffer-window) nil nil) (global-prettify-symbols-mode +1) (tool-bar-mode -1) #+end_src *** Theme and Icons #+begin_src emacs-lisp (add-to-list 'package-selected-packages 'base16-theme) (use-package base16-theme :if (package-installed-p 'base16-theme) :defines (base16-one-light-theme-colors) :custom (base16-theme-distinct-fringe-background nil) (base16-theme-highlight-mode-line 'contrast)) (defvar base16-current-theme-colors nil "Set to `base16-*-theme-colors' for currently selected theme.") (defun my/load-theme-and-configure () "Load theme and configure some faces." (interactive) (require 'base16-theme) (load-theme 'base16-one-light t) (setq base16-current-theme-colors base16-one-light-theme-colors) ;; Change outline headers to follow rainbow order (require 'outline) (dolist (pairing '((outline-1 . :base08) (outline-2 . :base09) (outline-3 . :base0A) (outline-4 . :base0B) (outline-5 . :base0C) (outline-6 . :base0D) (outline-7 . :base0E) (outline-8 . :base0F))) (set-face-attribute (car pairing) nil :foreground (plist-get base16-current-theme-colors (cdr pairing)))) (require 'org-faces) ;; Lighten `org-agenda-clocking' background to be more legible. (set-face-attribute 'org-agenda-clocking nil :background (plist-get base16-current-theme-colors :base01)) ;; Set `org-hide' face to actually match background colour (set-face-attribute 'org-hide nil :foreground (plist-get base16-current-theme-colors :base00))) (require 'server) (add-hook 'after-init-hook (lambda () (when (display-graphic-p) (my/load-theme-and-configure)))) (add-hook 'server-after-make-frame-hook (lambda () (when (display-graphic-p) (my/load-theme-and-configure)))) (add-to-list 'package-selected-packages 'nerd-icons) (use-package nerd-icons :if (package-installed-p 'nerd-icons)) (use-package nerd-icons-dired :after (nerd-icons dired) :load-path "external-packages/nerd-icons-dired/" :commands nerd-icons-dired-mode :hook (dired-mode . (lambda () (nerd-icons-dired-mode +1)))) (add-to-list 'package-selected-packages 'nerd-icons-ibuffer) (use-package nerd-icons-ibuffer :if (package-installed-p 'nerd-icons-ibuffer) :after nerd-icons :commands nerd-icons-ibuffer-mode :hook (ibuffer-mode . (lambda () (nerd-icons-ibuffer-mode +1)))) (add-to-list 'package-selected-packages 'nerd-icons-corfu) (use-package nerd-icons-corfu :if (package-installed-p 'nerd-icons-corfu) :after nerd-icons) #+end_src *** Modeline #+begin_src emacs-lisp (setopt mode-line-compact 'long) (which-function-mode +1) (line-number-mode +1) (column-number-mode +1) (size-indication-mode -1) #+end_src *** Visual fill column #+begin_src emacs-lisp (add-to-list 'package-selected-packages 'visual-fill-column) (use-package visual-fill-column :if (package-installed-p 'visual-fill-column) :hook ((org-src-mode . (lambda () (visual-fill-column-mode +1))) ((doc-view-mode image-mode) . (lambda () (visual-fill-column-mode -1)))) :custom (visual-fill-column-width 160) (visual-fill-column-center-text t) (visual-fill-column-enable-sensible-window-split t) :config (global-visual-line-mode +1) (global-visual-fill-column-mode +1)) #+end_src *** Font ligatures #+begin_src emacs-lisp (use-package ligature :load-path "external-packages/ligature.el/" :functions (ligature-set-ligatures global-ligature-mode) :config (ligature-set-ligatures '(text-mode prog-mode org-mode) '("<---" "<--" "<<-" "<-" "->" "-->" "--->" "<->" "<-->" "<--->" "<---->" "