Last active
July 29, 2026 19:31
-
-
Save codatory/02622399ea1f5c903e9410b8780ac3b5 to your computer and use it in GitHub Desktop.
2026 basic emacs config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; -*- lexical-binding: t; -*- | |
| ;;; early-init.el --- Minimal early initialization | |
| ;;; Commentary: | |
| ;; This file should contain ONLY settings that MUST run before packages load. | |
| ;; Keep this minimal (~30-40 lines max) for faster startup. | |
| ;;; Code: | |
| ;; Defer garbage collection during Emacs init (maximize init speed) | |
| (setq gc-cons-threshold most-positive-fixnum) | |
| (setq garbage-collection-messages t) | |
| ;; Adjust this up if you're getting frequent GCs during usage. | |
| (setq gc-cons-percentage 0.1) | |
| (add-hook 'after-init-hook | |
| (lambda () | |
| (setq gc-cons-threshold (* 4 1024 1024)) | |
| (run-with-idle-timer 300 t 'garbage-collect) | |
| (garbage-collect) | |
| (malloc-trim))) | |
| ;; Suppress visual noise during startup | |
| (setq inhibit-splash-screen t) | |
| (setq inhibit-startup-message t) | |
| (setq inhibit-startup-screen t) | |
| (setq initial-scratch-message nil) | |
| ;; Set theme first (loads before UI renders) | |
| (load-theme 'modus-vivendi-tinted t) | |
| ;; Disable UI elements that aren't useful for coding | |
| (menu-bar-mode -1) | |
| (when (fboundp 'tool-bar-mode) | |
| (tool-bar-mode -1)) | |
| (when (fboundp 'scroll-bar-mode) | |
| (scroll-bar-mode -1)) | |
| (when (fboundp 'set-fringe-mode) | |
| (set-fringe-mode 10)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; -*- lexical-binding: t; -*- | |
| ;;; init.el --- Emacs configuration orchestrator | |
| ;;; Commentary: | |
| ;; This file serves as the main entry point for your Emacs configuration. | |
| ;; It loads all the modular components in the correct order. | |
| ;;; Code: | |
| ;; Put customize vars in thier own file... | |
| (setq custom-file (locate-user-emacs-file "custom.el")) | |
| (load custom-file 'noerror 'nomessage) | |
| (setq package-archives | |
| '(("gnu" . "https://elpa.gnu.org/packages/") | |
| ("nongnu" . "https://elpa.nongnu.org/nongnu/") | |
| ("melpa" . "https://melpa.org/packages/"))) | |
| (setq package-archive-priorities | |
| '(("gnu" . 30) | |
| ("nongnu" . 20) | |
| ("melpa" . 10))) | |
| (setq use-package-always-defer t) | |
| (setq package-install-upgrade-built-in t) | |
| ;; Setup compliation to be optimized and less annoying | |
| (setq native-comp-jit-compilation t) ; Compile things when executed | |
| (setq native-comp-speed 2) ; This is default, -O2 | |
| (setq native-comp-options '("-march=native" "-mtune=native" "-pipe" "-g0")) ; Compile with all platform features | |
| (setq native-comp-driver-options '(;; -Wl,-z,pack-relative-relocs compresses | |
| ;; relocation tables to reduce file size and | |
| ;; slightly improve load times. | |
| "-Wl,-z,pack-relative-relocs" | |
| ;; -Wl,-O2 applies standard linker-level | |
| ;; optimizations (like string merging) to the | |
| ;; generated shared object. | |
| "-Wl,-O2" | |
| ;; -Wl,--as-needed prevents the linker from | |
| ;; recording dependencies on libraries that | |
| ;; are not actually used by the code. | |
| "-Wl,--as-needed")) | |
| ;; Limit compiler warnings | |
| (setq native-comp-async-report-warnings-errors 'silent) | |
| ;; Completely stop the *Warnings* buffer from popping up automatically | |
| (push '(category . comint) warning-suppress-types) | |
| (add-to-list 'display-buffer-alist | |
| '("\\*Warnings\\*" | |
| (display-buffer-no-window) | |
| (allow-no-window . t))) | |
| ;; Prevent bytecode compilation buffers from popping up | |
| (add-to-list 'display-buffer-alist | |
| '("\\*Compile-Log\\*" | |
| (display-buffer-no-window) | |
| (allow-no-window . t))) | |
| ;; Silence the byte-compiler warnings from splashing into view | |
| (setq byte-compile-warnings '(not free-vars unresolved callargs redefine)) | |
| ;; Preferences | |
| (global-visual-line-mode) ; Make working on text nicer | |
| (delete-selection-mode 1) ; Delete when typing over selected text | |
| (show-paren-mode 1) ; Highlight matching parens | |
| (electric-pair-mode 1) ; Automatically type matching delimiter pair | |
| (global-hl-line-mode 1) | |
| (column-number-mode 1) | |
| (line-number-mode 1) | |
| (global-auto-revert-mode 1) | |
| (global-visual-wrap-prefix-mode 1) | |
| (minibuffer-regexp-mode 1) | |
| (recentf-mode 1) | |
| (save-place-mode 1) | |
| (windmove-mode 1) | |
| (global-tab-line-mode 1) | |
| (prefer-coding-system 'utf-8) | |
| (set-default-coding-systems 'utf-8) | |
| (set-terminal-coding-system 'utf-8) | |
| (set-keyboard-coding-system 'utf-8) | |
| (setq load-prefer-newer t | |
| use-short-answers t | |
| make-backup-files nil | |
| create-lockfiles nil | |
| sentence-end-double-space nil | |
| show-paren-style 'expression | |
| show-paren-highlight-openparen t | |
| tab-always-indent 'complete | |
| use-dialog-box nil | |
| select-enable-clipboard t | |
| auto-revert-avoid-polling t | |
| ring-bell-function 'ignore | |
| global-auto-revert-non-file-buffers t | |
| ispell-really-hunspell t | |
| locale-coding-system 'utf-8) | |
| (unless (display-graphic-p) | |
| (xterm-mouse-mode 1) | |
| (setq fast-but-imprecise-scrolling t) | |
| (setq redisplay-skip-initial-frame-properties t) | |
| (use-package clipetty | |
| :ensure t | |
| :demand t)) | |
| (if (display-graphic-p) | |
| ;; Set up exec path when not run from terminal | |
| (use-package exec-path-from-shell | |
| :ensure t | |
| :if (display-graphic-p) | |
| :init | |
| (exec-path-from-shell-initialize))) | |
| (setq read-process-output-max (* 1024 1024)) ;; Increase the amount of data read from subprocesses | |
| (use-package compat | |
| :ensure t) | |
| (use-package diminish | |
| :ensure t) | |
| (use-package transient | |
| :ensure t) | |
| (use-package eat | |
| :ensure t | |
| :init | |
| (eat-eshell-mode) | |
| (setq eshell-visual-commands '())) | |
| (use-package system-packages | |
| :ensure t) | |
| ;; Load machine-specific inits | |
| (let ((local-init-file (locate-user-emacs-file "init.local.el"))) | |
| (load local-init-file 'noerror 'nomessage)) | |
| (use-package treesit-auto | |
| :ensure t | |
| :if (featurep 'treesit) | |
| :custom | |
| (treesit-auto-install 'prompt) | |
| :hook (after-init . global-treesit-auto-mode) | |
| :config | |
| (treesit-auto-add-to-auto-mode-alist 'all)) | |
| (use-package indent-bars | |
| :ensure t | |
| :custom | |
| (indent-bars-no-descend-lists 'skip) | |
| (indent-bars-treesit-support t) | |
| (indent-bars-treesit-ignore-blank-lines-types '("module")) | |
| (indent-bars-treesit-scope '((python function_definition class_definition for_statement | |
| if_statement with_statement while_statement))) | |
| :hook ((python-base-mode yaml-mode) . indent-bars-mode)) | |
| (use-package eglot | |
| :commands (eglot) | |
| :custom | |
| (eglot-autoshutdown t)) | |
| (use-package vc-fossil | |
| :ensure t | |
| :ensure-system-package fossil | |
| :init | |
| (add-to-list 'vc-handled-backends 'Fossil t)) | |
| (use-package vc-git | |
| :ensure-system-package git) | |
| (use-package project | |
| :custom | |
| (project-vc-extra-files-multi-directory-selection-use-vc t)) | |
| (use-package dired) | |
| (use-package dirvish | |
| :ensure t | |
| :custom | |
| (delete-by-moving-to-trash t) | |
| (dired-mouse-drag-files t) | |
| (mouse-drag-and-drop-region-cross-program t) | |
| :init | |
| (dirvish-override-dired-mode)) | |
| (use-package casual | |
| :ensure t) | |
| (use-package casual-dired | |
| :bind (:map dired-mode-map | |
| ("C-o" . casual-dired-tmenu))) | |
| (use-package casual-editkit | |
| :bind | |
| ("C-o" . casual-editkit-main-tmenu) | |
| ("C-c w" . casual-editkit-rectangle-tmenu) | |
| ("C-c g" . casual-editkit-registers-tmenu) | |
| ("C-c p" . casual-editkit-prject-tmenu)) | |
| (use-package casual-calc | |
| :bind | |
| (:map calc-mode-map ("C-o" . casual-calc-tmenu)) | |
| (:map calc-alg-map ("C-o" . casual-calc-tmenu))) | |
| (use-package embark | |
| :ensure t | |
| :bind | |
| (("C-." . embark-act) ;; pick some comfortable binding | |
| ("C-;" . embark-dwim) ;; good alternative: M-. | |
| ("C-h B" . embark-bindings)) ;; alternative for `describe-bindings' | |
| :config | |
| (add-to-list 'display-buffer-alist | |
| '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" | |
| nil | |
| (window-parameters (mode-line-format . none))))) | |
| (use-package embark-consult | |
| :ensure t | |
| :after (embark consult)) | |
| (use-package drag-stuff | |
| :ensure t | |
| :bind | |
| ("M-<up>" . drag-stuff-up) | |
| ("M-<down>" . drag-stuff-down) | |
| ("M-<left>" . drag-stuff-left) | |
| ("M-<right>" . drag-stuff-right)) | |
| (use-package which-key | |
| :ensure t | |
| :diminish which-key-mode | |
| :custom | |
| (which-key-idle-delay 0.4) | |
| :init | |
| (which-key-mode)) | |
| (use-package helpful | |
| :ensure t | |
| :bind (("C-h f" . helpful-callable) | |
| ("C-h v" . helpful-variable) | |
| ("C-h k" . helpful-key) | |
| ("C-h O" . helpful-command) | |
| ("C-c C-d" . helpful-at-point) | |
| ("C-h F" . helpful-function))) | |
| (use-package flymake | |
| :hook (prog-mode . flymake-mode) | |
| :custom | |
| (flymake-show-diagnostics-at-end-of-line t) | |
| :bind (:map flymake-mode-map | |
| ("M-n" . flymake-goto-next-error) | |
| ("M-p" . flymake-goto-prev-error))) | |
| (use-package savehist | |
| :demand t | |
| :custom | |
| (history-length 25) | |
| :config | |
| (savehist-mode)) | |
| (use-package vertico | |
| :ensure t | |
| :demand t | |
| :custom | |
| (vertico-resize t) ; Grow and shrink the Vertico minibuffer | |
| (vertico-cycle t) ; Enable cycling for `vertico-next/previous' | |
| :config | |
| (vertico-mode)) | |
| (use-package orderless | |
| :ensure t | |
| :demand t | |
| :custom | |
| (completion-styles '(orderless substring)) | |
| (completion-category-overrides '((file (styles partial-completion)))) | |
| (completion-pcm-leading-wildcard t)) ; Partial-completion behaves like substring | |
| (use-package consult | |
| :ensure t | |
| :bind (;; Minibuffer history | |
| ("M-y" . consult-yank-pop) | |
| ;; Buffer/File Navigation | |
| ("C-x b" . consult-buffer) | |
| ;; Search & Grep | |
| ("M-s d" . consult-find) | |
| ("M-s g" . consult-ripgrep) | |
| ("M-s l" . consult-line))) | |
| (use-package marginalia | |
| :ensure t | |
| :demand t | |
| :bind (:map minibuffer-local-map | |
| ("M-A" . marginalia-cycle)) | |
| :init | |
| (marginalia-mode 1)) | |
| (use-package corfu | |
| :ensure t | |
| :demand t | |
| :custom | |
| (corfu-auto t) ; Enable auto-completion | |
| (corfu-cycle t) ; Enable cycling for candidates | |
| (corfu-quit-at-boundary nil) ; Never quit at completion boundary | |
| (corfu-quit-no-match nil) ; Keep corfu open when no match is found | |
| :init | |
| (global-corfu-mode 1)) | |
| (use-package corfu-terminal | |
| :ensure t | |
| :unless (display-graphic-p) | |
| :after corfu | |
| :demand t | |
| :config | |
| (corfu-terminal-mode 1)) | |
| (use-package cape | |
| :ensure t | |
| :demand t | |
| :init | |
| ;; Append these hooks so they don't block mode-specific capfs (like LSP) | |
| (add-hook 'completion-at-point-functions #'cape-dabbrev t) | |
| (add-hook 'completion-at-point-functions #'cape-keyword t) | |
| (add-hook 'completion-at-point-functions #'cape-file t) | |
| (add-hook 'completion-at-point-functions #'cape-elisp-block t) | |
| (add-hook 'completion-at-point-functions #'cape-dict t)) | |
| (use-package sleek-modeline | |
| :ensure t | |
| :demand t | |
| :init | |
| (defun my/sleek-gc-segment () | |
| "Return GC elapsed time formatted for sleek-modeline" | |
| (format "GC: %.2fs" gc-elapsed)) | |
| :custom | |
| (sleek-modeline-show-icons nil) | |
| (sleek-modeline-show-modal-state t) | |
| (sleek-modeline-separator " | ") | |
| (sleek-modeline-vc-show-icon nil) | |
| :config | |
| (sleek-modeline-register-segment | |
| 'gc-time | |
| :fn #'my/sleek-gc-segment | |
| :side 'right | |
| :priority 10 | |
| :separator t) | |
| (sleek-modeline-mode 1)) | |
| (use-package org | |
| :custom | |
| (org-return-follow-link t) | |
| (org-startup-folded 'fold) | |
| (org-hide-emphasis-markers t) | |
| (org-src-fontify-natively t) | |
| (org-babel-sh-command "zsh")) | |
| (use-package ob-tangle | |
| :config | |
| (setq org-confirm-babel-evaluate nil)) | |
| (use-package org-roam | |
| :ensure t | |
| :config | |
| (org-roam-setup) | |
| ) | |
| (use-package gptel | |
| :ensure t) | |
| (use-package gptel-agent | |
| :ensure t | |
| :after gptel | |
| :commands gptel-agent | |
| :config | |
| (gptel-agent-update)) | |
| (use-package markdown-ts-mode | |
| :ensure t) | |
| (use-package olivetti | |
| :ensure t) | |
| ; todo: hook for when the interface has windows? | |
| (use-package zoom | |
| :ensure t | |
| :demand t | |
| :config | |
| (zoom-mode 1)) | |
| ;; Load machine-specific configurations | |
| (let ((local-config-file (locate-user-emacs-file "config.local.el"))) | |
| (load local-config-file 'noerror 'nomessage)) | |
| ;; Display startup time | |
| (add-hook 'emacs-startup-hook | |
| (lambda () | |
| (message "Emacs startup time: %.2f seconds" | |
| (float-time (time-subtract after-init-time before-init-time))))) | |
| (use-package auto-package-update | |
| :ensure t | |
| :demand t | |
| :config | |
| (auto-package-update-maybe)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment