diff options
author | Gene Pasquet <dev@etenil.net> | 2025-02-11 22:32:24 +0000 |
---|---|---|
committer | Gene Pasquet <dev@etenil.net> | 2025-02-11 22:32:24 +0000 |
commit | 3a7d14ff0088a912a8c0e4b844dc4e661ee97189 (patch) | |
tree | c6f373a4dea8a9d714507f136f3a234f673b7602 | |
parent | 48d65af9a5945b4532965270cb2e0cccd235b606 (diff) |
Refactor the crap out of Bedrock
-rw-r--r-- | README.md | 299 | ||||
-rw-r--r-- | early-substrate.el (renamed from early-init.el) | 17 | ||||
-rw-r--r-- | extras/base.el | 195 | ||||
-rw-r--r-- | extras/dev.el | 104 | ||||
-rw-r--r-- | extras/email.el | 30 | ||||
-rw-r--r-- | extras/org-intro.txt | 91 | ||||
-rw-r--r-- | extras/org.el | 161 | ||||
-rw-r--r-- | extras/researcher.el | 99 | ||||
-rw-r--r-- | extras/vim-like.el | 36 | ||||
-rw-r--r-- | extras/writer.el | 62 | ||||
-rw-r--r-- | init.el | 256 | ||||
-rw-r--r-- | substrate.el | 228 |
12 files changed, 253 insertions, 1325 deletions
@@ -1,57 +1,39 @@ -# Emacs Bedrock +# Emacs Substrate -Stepping stones to a better Emacs experience - -## Synopsis - -An *extremely* minimal Emacs starter kit uses just one external package by default, and only GNU-ELPA packages on an opt-in basis. Intended to be copied once and then modified as the user grows in knowledge and power. - -As of 2024-02-07, Bedrock is officially hosted on [Codeberg](https://codeberg.org/ashton314/emacs-bedrock). - -Mirrors: - - [Old project on SourceHut](https://sr.ht/~ashton314/emacs-bedrock/) - - [GitHub](https://github.com/ashton314/emacs-bedrock) (just a place holder) +A clean basis to organically grow your config onto. **NOTICE:** Requires Emacs 29.1 or better. ## Description -This is a minimal Emacs starter kit. Like, *really* minimal. Here's the short of the philosophy: +This is a minimal Emacs base config. Here's the short of the philosophy: - Focus on using default, built-in Emacs behavior - - Yes, we all love our fancy third-party packages. This starter kit focuses on what is built-in to Emacs. Why? Because there are too many good packages and picking and choosing the best is a joy we leave to the user. - - - Explain every customization and encourage modification - - The goal of this starter kit is to encourage end-user adaptation and growth. All of the `.el` files should be legible and, more importantly, justify in plain English the rationale for adding the configuration they do. - + - Emacs-lisp centric, encourage configuration through code + - Allow update and upgrade of substrate - No magic - We keep things *crushingly* simple here. That means no fancy loadable modules or whatnot. Everything is as straight-forward as can be. +## Installation -There are two files of interest: `early-init.el` and `init.el`. +To install emacs-substrate, clone this repository somewhere, then create the files: -### `early-init.el` +```lisp +;; ~/.emacs.d/early-init.el +(add-to-list 'load-path "<path-where-emacs-substrate-was-cloned>") -The early init file uses *strictly* built-in Emacs features to do the following: - - - Improve startup time - - Set up initial frame behavior - -### `init.el` - -This is where the meat of all configuration goes. This file: +(require 'early-substrate) +``` - - Add minor UI niceties (e.g. clock in the tab-bar, full-screen by default, etc.) - - Set the default theme (`modus-vivendi`) - - Turn on discovery aids (e.g. `help-quick`, [which-key](https://github.com/justbur/emacs-which-key), etc.) +```lisp +;; ~/.emacs.d/init.el +(require 'substrate) -### Trying this out without committing too hard +;; Set custom variables here -Emacs 29.1 added the handy `--init-directory` flag. This means that you can run `emacs --init-directory path/to/emacs-bedrock/` and all the customizations and package installations will be isolated to the project directory. Emacs should only add files that are already in the `.gitignore`. +(substrate-init) -Once you're happy, you should just copy `init.el` and `early-init.el` to `~/.emacs.d/`. +;; The rest of your config below +``` ## Screenshots @@ -63,155 +45,10 @@ Basic code editing: line numbers and `hl-line-mode`.  -`which-key` package in action: hit `C-x` and wait for a second to get a pop-up window of what all next available keybindings are. - - - -[Movie of `which-key` in motion](screenshots/which_key.mov) - -Basic completion: hit `TAB` twice to pull up the `*Completions*` buffer, then `TAB` once again to automatically put the cursor into that buffer. (Configurable to pull up and auto-select faster, of course, but this behaves closer to the stock Emacs experience.) - - - -Basic completion interface in action. - - - -[Movie of the completion interface in action](screenshots/basic_completion.mov) - -A bunch of bells and whistles: - - - Vertico completion framework enabled (`base.el` extra) - - Consult enabled for buffer-switching preview (`base.el` extra) - - Corfu completion-at-point enabled (`base.el` extra) - - Smooth scrolling (enabled by default) - -[Movie of all the bells and whistles turned on](screenshots/everything_demo.mov) - -## Extras - -For those who'd like a little more help in tailoring Emacs for specific purposes, the `extras/` folder contains a few Emacs Lisp files with example configurations for various packages. You can copy just the config you want into `init.el` or include them wholesale via `(load-file "~/.emacs.d/extras/file-name.el")`. - -**NOTE:** If you copy the `extras/` directory to `~/.emacs.d/` or wherever you're setting `user-emacs-directory`, then simply incrementing the appropriate lines in the `init.el` file should work. - -Extras: - - - Base UI Enhancements - - Development tools - - Org-mode - - Vim refugee - - Researcher - - Email (TODO: mu4e, EBDB) - -#### Base UI Enhancements: `extras/base.el` - -Packages this extra adds: - - - [Avy](https://github.com/abo-abo/avy) - - [Embark](https://github.com/oantolin/embark) - - [Vertico](https://github.com/minad/vertico) - - [Marginalia](https://github.com/minad/marginalia/) - - [Corfu](https://github.com/minad/corfu) - - [Consult](https://github.com/minad/consult) - - [Orderless](https://github.com/oantolin/orderless) - - [wgrep](https://github.com/mhayashi1120/Emacs-wgrep) - -Along with a few ancillary packages that enhance the above. - -These are some of the best UI enhancements that Emacs has to offer. Vertico and Consult make common operations like searching files, switching buffers, etc. a breeze. Corfu enhances the "completion at point" (aka "tab-to-complete") to show a little popup window like what you'd be used to in e.g. VS Code. - -Avy is the fastest way to move around in a buffer, and it can do a *lot*.[^1] Embark is kind of like a right-click context menu, but entirely keyboard driven. - -wgrep makes grep buffers editable. This means you can `consult-ripgrep` → search project → `embark-act` → `embark-export` → `wgrep-change-to-wgrep-mode` to do search-and-replace across an entire project in one fell swoop. See [Warp Factor Refactoring](https://lambdaland.org/posts/2023-05-31_warp_factor_refactor/) for more on this workflow. - -#### Development tools: `extras/dev.el` - -Packages this extra adds: - - - [magit](https://magit.vc) - - Markdown, YAML, and JSON modes - -Magit is the best Git interface in the known universe. Some people use Emacs just so they can use Magit. It's that good. Entry point is bound to `C-c g` by default. - -Built-in packages that this extra configures: - - - [Eglot](https://github.com/joaotavora/eglot) ([Language Server Protocol (LSP) client](https://microsoft.github.io/language-server-protocol/)) - - Treesit ([Tree-Sitter](https://github.com/tree-sitter) support) - -Both of these packages are new in Emacs 29. **Be sure to run `M-x treesit-install-language-grammar` to install the language grammar you'll need before editing a file the respective language for the first time!** This is a quirk of how the built-in tree-sitter works; packages like [treesit-auto](https://github.com/renzmann/treesit-auto) can help with this if it becomes too much of an annoyance. - -#### Org-mode: `extras/org.el` - -This extra configures `org-mode`. There is a *lot* that Bedrock cannot configure out of the box—you will need to modify all variables to fit your file system and needs, as explained in comments in the file. - -#### Vim refugee: `extras/vim-like.el` - -Packages this extra adds: - - - [Evil](https://github.com/emacs-evil/evil) - -If you like Vim keybindings, then this is the extra for you. It configures `evil-mode` and enables it, so you get Vim-like keybindings all throughout Emacs. I understand that this is the best Vim emulation outside of Vim itself. I use `evil-mode` in all my work. - -Other packages that I use personally, but are not on GNU or non-GNU ELPA and so left out of the config include: - - - [Evil-Collection](https://github.com/emacs-evil/evil-collection) Add Evil-friendly keybindings to lots of corners of Emacs - - [Evil-Leader](https://github.com/cofi/evil-leader) Setting a prefix (i.e. "leader") key - - [Origami](https://github.com/gregsexton/origami.el) Code folding - -#### Researcher: `extras/researcher.el` - -Packages this extra includes: - - - [Citar](https://github.com/emacs-citar/citar) - - [Denote](https://protesilaos.com/emacs/denote) - -Citar provides a completing-read interface into your bibliography and can automatically insert citations in LaTeX, Markdown, and org-mode. - -Denote is a simple note taking system that doesn't rely on any tools except some common Unix utilities like `grep` and `find`. - -Citar lives in [Melpa](https://melpa.org/), so you will need to [add Melpa to your package-archives](https://melpa.org/#/getting-started). - -#### Writing: `extras/writer.el` - -Packages this extra adds: - - - [Jinx](https://github.com/minad/jinx) - - [Olivetti](https://github.com/rnkn/olivetti) - -Jinx is the spell-checker you will wish every program had. - -Olivetti automatically balances window margins so your text stays nice and centered—handy for wide monitors. - -#### Email `extras/email.el` +## Philosophy TODO -## Using - -Clone this repository wherever. Then you should copy `early-init.el`, `init.el`, and (optionally, recommended) `extras/` into your `~/.emacs.d/` repository: - -```bash -git clone https://codeberg.org/ashton314/emacs-bedrock.git -mkdir -p ~/.emacs.d/ -cp emacs-bedrock/early-init.el ~/.emacs.d/ -cp emacs-bedrock/init.el ~/.emacs.d/ -cp -r emacs-bedrock/extras ~/.emacs.d/ -``` - -Fire up Emacs and you're good to go! - -### Philosophy - -Many people are looking for a good set of defaults and some easy-to-use switches that let Emacs get out of the way and let them work on what they want to. This is fine. This is not what Bedrock tries to do. - -Emacs is the most customizable piece of software in existence. (No citation needed.) My goal with Bedrock is to make Emacs a little nicer by enabling some things that I personally think should be enabled by default. Bedrock goes a little further by suggesting a few well-built packages that go on to enhance the experience. - -Bedrock encourages inspection and modification. I don't plan on making some core that periodically gets updated. You can think of this as just some guy's config that you wanted to adopt. - -As an example of a deliberate choice, the `help-quick` buffer pops open on startup. Once a user has gotten used to this, they can just go into their `init.el` file and modify it themselves to remove that hook if they don't like it. It's a simple one-line change, and only users who are ready for it will do it. - -When I started learning Emacs, my dad gave me his `.emacs` file. (That's what we used back in ye olden days instead of `.emacs.d/init.el` and stuff.) I used it without modification for many years. Eventually I learned how to write my own functions and customizations. This package aims to give other users a similar experience. When someone comes to me and expresses their desire to learn Emacs, I can point them at this to help them get over the initial hump, but not coddle them so much that they're afraid or unable to change things to their liking. - ## Requirements Emacs 29.1 or later. @@ -223,102 +60,8 @@ Emacs 29.1 is, as of 2023-09-04, the latest stable release. The specific feature - Built-in tree-sitter support - Built-in LSP client (Eglot) -## Development - -This is version `1.3.1`. - -As of `1.0.0`, no new `use-package` declarations will be added to `init.el`. No promises on the extras! - -I welcome any feedback you may have. You can [open issues](https://todo.sr.ht/~ashton314/emacs-bedrock) or [drop me a line](https://lambdaland.org/#contact) directly with any comments or suggestions. - -Thanks to all the folks who have contributed suggestions and bug reports. Thank you also for being patient with me as I work on this project as a hobby. :) - -### Roadmap - -See the [issue tracker](https://codeberg.org/ashton314/emacs-bedrock/issues) on Codeberg. - -## Changelog - - - 1.4.0 - - 2024-12-14 - - Add `extras/writer.el`. - - - 1.3.1 - - Fix consult-history binding in Eshell to not override `isearch-backwards`. (#13) - - - 1.3.0 - - Change magit keybinding to standard `C-x g`; drop non-standard ones. (Thanks Vincent Conus!) - - Don't set `C-s` to `consult-line` in `extras/base.el`; instead, use the recommended keybindings from the Consult manual. (Thanks Enzo Do rosario, Thomas Riccardi, and Preston Hunt for discussion!) - - Add sample Denote config. - - Improve latency by slowing down auto-revert polling. (Thanks Jeff Johnson!) - - - 1.2.0 - - 2023-09-21 - - Add packages [Cape](https://github.com/minad/cape) (+ basic configuration) and wgrep. Add a binding for `consult-ripgrep`. - - - 1.1.0 - - 2023-09-08 - - Rename "mixins" → "extras", as mixin has the flavor of being some kind of special thingy. "Extra" gets at the purpose of these files. - - - 1.0.0 - - 2023-09-04 - - First "stable" release! Line number width improved, fix default load paths, expand Eglot and Vertico config, fix Corfu load. - - - 0.2.1 - - 2023-06-20 - - Minor bug fixes; add Embark package. - - - 0.2.0 - - 2023-03-14 - - Flesh out the `mixin/vim-like.el` so that there's *some* Vim configuration. - - - 0.1.0 - - 2023-01-17 - - Begin work on `mixin/org.el`, turn on windmove-mode. - - - 0.0.2 - - 2023-01-03 - - Reorganize to slim down `early-init.el` and add the first mixin files. - - - 0.0.1 - - 2023-01-03 - - Initial "release". - -## Authors +## Credits Creator and maintainer: - Ashton Wiersdorf https://lambdaland.org - -Contributors: - - - Justin Koh - - George Kettleborough - - Enzo Do Rosario - - Ed Singleton - - Vincent Conus - -[^1]: https://karthinks.com/software/avy-can-do-anything/ diff --git a/early-init.el b/early-substrate.el index 9782b87..a4396c0 100644 --- a/early-init.el +++ b/early-substrate.el @@ -1,14 +1,3 @@ -;;; ________ _______ __ __ -;;; / | / \ / | / | -;;; $$$$$$$$/ _____ ____ ______ _______ _______ $$$$$$$ | ______ ____$$ | ______ ______ _______$$ | __ -;;; $$ |__ / \/ \ / \ / |/ | $$ |__$$ |/ \ / $$ |/ \ / \ / $$ | / | -;;; $$ | $$$$$$ $$$$ |$$$$$$ /$$$$$$$//$$$$$$$/ $$ $$</$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$$/$$ |_/$$/ -;;; $$$$$/ $$ | $$ | $$ |/ $$ $$ | $$ \ $$$$$$$ $$ $$ $$ | $$ $$ | $$/$$ | $$ $$ | $$ $$< -;;; $$ |_____$$ | $$ | $$ /$$$$$$$ $$ \_____ $$$$$$ | $$ |__$$ $$$$$$$$/$$ \__$$ $$ | $$ \__$$ $$ \_____$$$$$$ \ -;;; $$ $$ | $$ | $$ $$ $$ $$ / $$/ $$ $$/$$ $$ $$ $$ | $$ $$/$$ $$ | $$ | -;;; $$$$$$$$/$$/ $$/ $$/ $$$$$$$/ $$$$$$$/$$$$$$$/ $$$$$$$/ $$$$$$$/ $$$$$$$/$$/ $$$$$$/ $$$$$$$/$$/ $$/ - - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Basic settings for quick startup and convenience @@ -16,8 +5,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Startup speed, annoyance suppression -(setq bedrock--initial-gc-threshold gc-cons-threshold) -(setq gc-cons-threshold 10000000) (setq byte-compile-warnings '(not obsolete)) (setq warning-suppress-log-types '((comp) (bytecomp))) (setq native-comp-async-report-warnings-errors 'silent) @@ -28,6 +15,8 @@ ;; Default frame configuration: full screen, good-looking title bar on macOS (setq frame-resize-pixelwise t) (tool-bar-mode -1) ; All these tools are in the menu-bar anyway +(menu-bar-mode -1) +(scroll-bar-mode -1) (setq default-frame-alist '((fullscreen . maximized) ;; You can turn off scroll bars by uncommenting these lines: @@ -40,3 +29,5 @@ (foreground-color . "#ffffff") (ns-appearance . dark) (ns-transparent-titlebar . t))) +(provide 'early-substrate) +;; End of early-substrate.el diff --git a/extras/base.el b/extras/base.el deleted file mode 100644 index 7f4dd1a..0000000 --- a/extras/base.el +++ /dev/null @@ -1,195 +0,0 @@ -;;; Emacs Bedrock -;;; -;;; Extra config: Base enhancements - -;;; Usage: Append or require this file from init.el to enable various UI/UX -;;; enhancements. -;;; -;;; The consult package in particular has a vast number of functions that you -;;; can use as replacements to what Emacs provides by default. Please see the -;;; consult documentation for more information and help: -;;; -;;; https://github.com/minad/consult -;;; -;;; In particular, many users may find `consult-line' to be more useful to them -;;; than isearch, so binding this to `C-s' might make sense. This is left to the -;;; user to configure, however, as isearch and consult-line are not equivalent. - -;;; Contents: -;;; -;;; - Motion aids -;;; - Power-ups: Embark and Consult -;;; - Minibuffer and completion -;;; - Misc. editing enhancements - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Motion aids -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(use-package avy - :ensure t - :demand t - :bind (("C-c j" . avy-goto-line) - ("s-j" . avy-goto-char-timer))) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Power-ups: Embark and Consult -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; Consult: Misc. enhanced commands -(use-package consult - :ensure t - :bind ( - ;; Drop-in replacements - ("C-x b" . consult-buffer) ; orig. switch-to-buffer - ("M-y" . consult-yank-pop) ; orig. yank-pop - ;; Searching - ("M-s r" . consult-ripgrep) - ("M-s l" . consult-line) ; Alternative: rebind C-s to use - ("M-s s" . consult-line) ; consult-line instead of isearch, bind - ("M-s L" . consult-line-multi) ; isearch to M-s s - ("M-s o" . consult-outline) - ;; Isearch integration - :map isearch-mode-map - ("M-e" . consult-isearch-history) ; orig. isearch-edit-string - ("M-s e" . consult-isearch-history) ; orig. isearch-edit-string - ("M-s l" . consult-line) ; needed by consult-line to detect isearch - ("M-s L" . consult-line-multi) ; needed by consult-line to detect isearch - ) - :config - ;; Narrowing lets you restrict results to certain groups of candidates - (setq consult-narrow-key "<")) - -;; Embark: supercharged context-dependent menu; kinda like a -;; super-charged right-click. -(use-package embark - :ensure t - :demand t - :after avy - :bind (("C-c a" . embark-act)) ; bind this to an easy key to hit - :init - ;; Add the option to run embark when using avy - (defun bedrock/avy-action-embark (pt) - (unwind-protect - (save-excursion - (goto-char pt) - (embark-act)) - (select-window - (cdr (ring-ref avy-ring 0)))) - t) - - ;; After invoking avy-goto-char-timer, hit "." to run embark at the next - ;; candidate you select - (setf (alist-get ?. avy-dispatch-alist) 'bedrock/avy-action-embark)) - -(use-package embark-consult - :ensure t) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Minibuffer and completion -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; Vertico: better vertical completion for minibuffer commands -(use-package vertico - :ensure t - :init - ;; You'll want to make sure that e.g. fido-mode isn't enabled - (vertico-mode)) - -(use-package vertico-directory - :ensure nil - :after vertico - :bind (:map vertico-map - ("M-DEL" . vertico-directory-delete-word))) - -;; Marginalia: annotations for minibuffer -(use-package marginalia - :ensure t - :config - (marginalia-mode)) - -;; Corfu: Popup completion-at-point -(use-package corfu - :ensure t - :init - (global-corfu-mode) - :bind - (:map corfu-map - ("SPC" . corfu-insert-separator) - ("C-n" . corfu-next) - ("C-p" . corfu-previous))) - -;; Part of corfu -(use-package corfu-popupinfo - :after corfu - :ensure nil - :hook (corfu-mode . corfu-popupinfo-mode) - :custom - (corfu-popupinfo-delay '(0.25 . 0.1)) - (corfu-popupinfo-hide nil) - :config - (corfu-popupinfo-mode)) - -;; Make corfu popup come up in terminal overlay -(use-package corfu-terminal - :if (not (display-graphic-p)) - :ensure t - :config - (corfu-terminal-mode)) - -;; Fancy completion-at-point functions; there's too much in the cape package to -;; configure here; dive in when you're comfortable! -(use-package cape - :ensure t - :init - (add-to-list 'completion-at-point-functions #'cape-dabbrev) - (add-to-list 'completion-at-point-functions #'cape-file)) - -;; Pretty icons for corfu -(use-package kind-icon - :if (display-graphic-p) - :ensure t - :after corfu - :config - (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter)) - -(use-package eshell - :init - (defun bedrock/setup-eshell () - ;; Something funny is going on with how Eshell sets up its keymaps; this is - ;; a work-around to make C-r bound in the keymap - (keymap-set eshell-mode-map "C-r" 'consult-history)) - :hook ((eshell-mode . bedrock/setup-eshell))) - -;; Eat: Emulate A Terminal -(use-package eat - :ensure t - :custom - (eat-term-name "xterm") - :config - (eat-eshell-mode) ; use Eat to handle term codes in program output - (eat-eshell-visual-command-mode)) ; commands like less will be handled by Eat - -;; Orderless: powerful completion style -(use-package orderless - :ensure t - :config - (setq completion-styles '(orderless))) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Misc. editing enhancements -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; Modify search results en masse -(use-package wgrep - :ensure t - :config - (setq wgrep-auto-save-buffer t)) diff --git a/extras/dev.el b/extras/dev.el deleted file mode 100644 index f1a02d4..0000000 --- a/extras/dev.el +++ /dev/null @@ -1,104 +0,0 @@ -;;; Emacs Bedrock -;;; -;;; Extra config: Development tools - -;;; Usage: Append or require this file from init.el for some software -;;; development-focused packages. -;;; -;;; It is **STRONGLY** recommended that you use the base.el config if you want to -;;; use Eglot. Lots of completion things will work better. -;;; -;;; This will try to use tree-sitter modes for many languages. Please run -;;; -;;; M-x treesit-install-language-grammar -;;; -;;; Before trying to use a treesit mode. - -;;; Contents: -;;; -;;; - Built-in config for developers -;;; - Version Control -;;; - Common file types -;;; - Eglot, the built-in LSP client for Emacs - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Built-in config for developers -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(use-package emacs - :config - ;; Treesitter config - - ;; Tell Emacs to prefer the treesitter mode - ;; You'll want to run the command `M-x treesit-install-language-grammar' before editing. - (setq major-mode-remap-alist - '((yaml-mode . yaml-ts-mode) - (bash-mode . bash-ts-mode) - (js2-mode . js-ts-mode) - (typescript-mode . typescript-ts-mode) - (json-mode . json-ts-mode) - (css-mode . css-ts-mode) - (python-mode . python-ts-mode))) - :hook - ;; Auto parenthesis matching - ((prog-mode . electric-pair-mode))) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Version Control -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; Magit: best Git client to ever exist -(use-package magit - :ensure t - :bind (("C-x g" . magit-status))) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Common file types -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(use-package markdown-mode - :hook ((markdown-mode . visual-line-mode))) - -(use-package yaml-mode - :ensure t) - -(use-package json-mode - :ensure t) - -;; Emacs ships with a lot of popular programming language modes. If it's not -;; built in, you're almost certain to find a mode for the language you're -;; looking for with a quick Internet search. - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Eglot, the built-in LSP client for Emacs -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; Helpful resources: -;; -;; - https://www.masteringemacs.org/article/seamlessly-merge-multiple-documentation-sources-eldoc - -(use-package eglot - ;; no :ensure t here because it's built-in - - ;; Configure hooks to automatically turn-on eglot for selected modes - ; :hook - ; (((python-mode ruby-mode elixir-mode) . eglot)) - - :custom - (eglot-send-changes-idle-time 0.1) - (eglot-extend-to-xref t) ; activate Eglot in referenced non-project files - - :config - (fset #'jsonrpc--log-event #'ignore) ; massive perf boost---don't log every event - ;; Sometimes you need to tell Eglot where to find the language server - ; (add-to-list 'eglot-server-programs - ; '(haskell-mode . ("haskell-language-server-wrapper" "--lsp"))) - ) diff --git a/extras/email.el b/extras/email.el deleted file mode 100644 index 2ff7dd4..0000000 --- a/extras/email.el +++ /dev/null @@ -1,30 +0,0 @@ -;;; Emacs Bedrock -;;; -;;; Extra config: Email - -;;; Usage: Append or require this file from init.el for Email in Emacs. You will -;;; need to do some heavy customization depending on your email provider. - -;;; Contents: -;;; -;;; - Core Email Packages -;;; - Sample Setup: Gmail -;;; - Sample Setup: Fastmail - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Core Email Packages -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Sample Setup: Gmail -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Sample Setup: Fastmail -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/extras/org-intro.txt b/extras/org-intro.txt deleted file mode 100644 index ca56bf4..0000000 --- a/extras/org-intro.txt +++ /dev/null @@ -1,91 +0,0 @@ -Many people use Emacs just so they can use org-mode. If you're one of them, -welcome! - -This is a short introduction to get an overview of what org-mode does. - -Org-mode is hard to understand because there are broadly three different things -that org-mode does. They're related but distinct enough to make things -confusing. We'll focus on three different use cases for org-mode: - - - org-mode as markup - - org-mode as a task tracker - - org-mode as a computational notebook - -Org-mode as markup -================== - -Org-mode is first and foremost a lightweight markup language, just like -Markdown. (In fact, they were developed at around the same time.) There are a -few differences in syntax, but if you're already familiar with the ideas behind -Markdown you should be just fine. - -If you've never worked with something like Markdown before, you can think of it -as a system of special characters that indicate some formatting, e.g. you mark -text as being *bold*, _underlined_, or /italicized/ by surrounding it with -asterisks, underscores, and slashes respectively. - -Once you've authored a file with org-mode, you can use Emacs to export the -org-mode into another format, like HTML, Markdown, ODT, or PDF with LaTeX. Run -`org-export` to bring up the export menu. - -Org-mode as a task tracker -========================== - -Like Markdown, org-mode has headings. Instead of starting headings with one or -more "#" signs, org-mode uses asterisks. An org mode heading looks like this: - - * Heading - - Lorem ipsum… - - ** Subheading - - Dolor sit amet… - - ** Another subheading - - Magister Ludi… - - * Another top-level heading - - Quam elivit… - -*Any* heading can become a task. This might feel overwhelming, and rightly so. -For now, just start with a list of top-level headings with the TODO keyword. - - * TODO Do important thing - * TODO Take Yessica to get her haircut - * TODO Finish configuring Emacs - -You can associate deadlines, notes, tags, attachments, different TODO states, -etc. to these headlines. Read the org-mode manual for more information. - -While there are cases when you might want to put a TODO item in an arbitrary -file, most of the time these TODOs will go into an agenda file. - -The `org-directory` and `org-agenda-files` variables control where org-mode -looks to find TODO items to generate what's called an agenda: an agenda is a -view of all your headlines with TODO (or other states like WAITING, as -configured) status set. The agenda usually organizes these by date and makes it -easy for you to sort, filter, and modify these items. - -For now, just start with one org-mode file at `~/Documents/org/inbox.org`. Put -some headings with TODO keywords in that file and save it. Be sure to add a -deadline for today. (You can run `org-deadline` to do this automatically for -you.) Now invoke `org-agenda`. This should pull up a buffer with those headlines -you just added in it. - -There are too many ways you can configure this for me to describe here. Just -start small: have one or two files in the `org-agenda-files` list to act as -where you put your TODO items. Use the agenda to view and modify those TODOs. - -Org-mode as a computational notebook -==================================== - -You can use org-mode as a kind of computational notebook. Org-mode lets you have -blocks of source code in line, and then you can instruct org-mode to evaluate -those blocks of code for you. - -The setup varies from language to language, and I'm not going to try to explain -that here. If you're writing code, you should be familiar with reading -documentation, so I'll let you do that yourself. :) diff --git a/extras/org.el b/extras/org.el deleted file mode 100644 index 8f8db71..0000000 --- a/extras/org.el +++ /dev/null @@ -1,161 +0,0 @@ -;;; Emacs Bedrock -;;; -;;; Extra config: Org-mode starter config - -;;; Usage: Append or require this file from init.el for some software -;;; development-focused packages. -;;; -;;; Org-mode is a fantastically powerful package. It does a lot of things, which -;;; makes it a little difficult to understand at first. -;;; -;;; We will configure Org-mode in phases. Work with each phase as you are -;;; comfortable. -;;; -;;; YOU NEED TO CONFIGURE SOME VARIABLES! The most important variable is the -;;; `org-directory', which tells org-mode where to look to find your agenda -;;; files. - -;;; See "org-intro.txt" for a high-level overview. - -;;; Contents: -;;; -;;; - Critical variables -;;; - Phase 1: editing and exporting files -;;; - Phase 2: todos, agenda generation, and task tracking -;;; - Phase 3: extensions (org-roam, etc.) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Critical variables -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;;; These variables need to be set for Org-mode's full power to be unlocked! -;;; -;;; You can read the documentation for any variable with `C-h v'. If you have -;;; Consult configured (see the `base.el' file) then it should help you find -;;; what you're looking for. - -;;; Phase 1 variables - -;;; Phase 2 variables - -;; Agenda variables -(setq org-directory "~/Documents/org/") ; Non-absolute paths for agenda and - ; capture templates will look here. - -(setq org-agenda-files '("inbox.org" "work.org")) - -;; Default tags -(setq org-tag-alist '( - ;; locale - (:startgroup) - ("home" . ?h) - ("work" . ?w) - ("school" . ?s) - (:endgroup) - (:newline) - ;; scale - (:startgroup) - ("one-shot" . ?o) - ("project" . ?j) - ("tiny" . ?t) - (:endgroup) - ;; misc - ("meta") - ("review") - ("reading"))) - -;; Org-refile: where should org-refile look? -(setq org-refile-targets 'FIXME) - -;;; Phase 3 variables - -;; Org-roam variables -(setq org-roam-directory "~/Documents/org-roam/") -(setq org-roam-index-file "~/Documents/org-roam/index.org") - -;;; Optional variables - -;; Advanced: Custom link types -;; This example is for linking a person's 7-character ID to their page on the -;; free genealogy website Family Search. -(setq org-link-abbrev-alist - '(("family_search" . "https://www.familysearch.org/tree/person/details/%s"))) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Phase 1: editing and exporting files -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(use-package org - :hook ((org-mode . visual-line-mode) ; wrap lines at word breaks - (org-mode . flyspell-mode)) ; spell checking! - - :bind (:map global-map - ("C-c l s" . org-store-link) ; Mnemonic: link → store - ("C-c l i" . org-insert-link-global)) ; Mnemonic: link → insert - :config - (require 'oc-csl) ; citation support - (add-to-list 'org-export-backends 'md) - - ;; Make org-open-at-point follow file links in the same window - (setf (cdr (assoc 'file org-link-frame-setup)) 'find-file) - - ;; Make exporting quotes better - (setq org-export-with-smart-quotes t) - ) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Phase 2: todos, agenda generation, and task tracking -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; Yes, you can have multiple use-package declarations. It's best if their -;; configs don't overlap. Once you've reached Phase 2, I'd recommend merging the -;; config from Phase 1. I've broken it up here for the sake of clarity. -(use-package org - :config - ;; Instead of just two states (TODO, DONE) we set up a few different states - ;; that a task can be in. Run - ;; M-x describe-variable RET org-todo-keywords RET - ;; for documentation on how these keywords work. - (setq org-todo-keywords - '((sequence "TODO(t)" "WAITING(w@/!)" "STARTED(s!)" "|" "DONE(d!)" "OBSOLETE(o@)"))) - - ;; Refile configuration - (setq org-outline-path-complete-in-steps nil) - (setq org-refile-use-outline-path 'file) - - (setq org-capture-templates - '(("c" "Default Capture" entry (file "inbox.org") - "* TODO %?\n%U\n%i") - ;; Capture and keep an org-link to the thing we're currently working with - ("r" "Capture with Reference" entry (file "inbox.org") - "* TODO %?\n%U\n%i\n%a") - ;; Define a section - ("w" "Work") - ("wm" "Work meeting" entry (file+headline "work.org" "Meetings") - "** TODO %?\n%U\n%i\n%a") - ("wr" "Work report" entry (file+headline "work.org" "Reports") - "** TODO %?\n%U\n%i\n%a"))) - - ;; An agenda view lets you see your TODO items filtered and - ;; formatted in different ways. You can have multiple agenda views; - ;; please see the org-mode documentation for more information. - (setq org-agenda-custom-commands - '(("n" "Agenda and All Todos" - ((agenda) - (todo))) - ("w" "Work" agenda "" - ((org-agenda-files '("work.org"))))))) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Phase 3: extensions -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; TODO diff --git a/extras/researcher.el b/extras/researcher.el deleted file mode 100644 index 132215c..0000000 --- a/extras/researcher.el +++ /dev/null @@ -1,99 +0,0 @@ -;;; Emacs Bedrock -;;; -;;; Extra config: Researcher - -;;; Usage: Append or require this file from init.el for research -;;; helps. If you write papers in LaTeX and need to manage your -;;; citations or keep track of notes, this set of packages is for you. -;;; -;;; Denote is a note taking package that facilitates a Zettelkasten -;;; method. Denote works by enforcing a particular file naming -;;; strategy. This makes it easy to link and tag notes. -;;; -;;; NOTE: the Citar package lives on the MELPA repository; you will -;;; need to update the `package-archives' variable in init.el before -;;; before loading this; see the comment in init.el under "Package -;;; initialization". -;;; -;;; Highly recommended to enable this file with the UI enhancements in -;;; `base.el', as Citar works best with the Vertico completing-read -;;; interface. Also recommended is the `writer.el' extra config, which -;;; adds some nice features for spell-checking etc. - -;;; Contents: -;;; -;;; - Citation Management -;;; - Note Taking: Denote - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Critical variables -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;;; These variables must be set for Citar to work properly! - -(setopt citar-bibliography '("~/refs.bib")) ; paths to your bibtex files - -;;; These variables are needed for Denote -(setopt denote-directory (expand-file-name "~/Documents/notes/")) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Citation Management -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(use-package citar - :ensure t - :bind (("C-c b" . citar-insert-citation) - :map minibuffer-local-map - ("M-b" . citar-insert-preset)) - :custom - ;; Allows you to customize what citar-open does - (citar-file-open-functions '(("html" . citar-file-open-external) - ;; ("pdf" . citar-file-open-external) - (t . find-file)))) - -;; Optional: if you have the embark package installed, enable the ability to act -;; on citations with Citar by invoking `embark-act'. -;(use-package citar-embark -; :after citar embark -; :diminish "" -; :no-require -; :config (citar-embark-mode)) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Note Taking: Denote -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; Denote is a simple but powerful note-taking system that relies on a -;; file-naming schema to make searching and finding notes easily. The -;; Denote package provides commands that make the note taking scheme -;; easy to follow. See the manual at: -;; -;; https://protesilaos.com/emacs/denote -;; -(use-package denote - :config - (denote-rename-buffer-mode) - (require 'denote-journal-extras)) - -;; Integrate citar and Denote: take notes on bibliographic entries -;; through Denote -(use-package citar-denote - :after (:any citar denote) - :custom - (citar-denote-file-type 'org) - (citar-denote-keyword "bib") - (citar-denote-signature nil) - (citar-denote-subdir "") - (citar-denote-template nil) - (citar-denote-title-format "title") - (citar-denote-title-format-andstr "and") - (citar-denote-title-format-authors 1) - (citar-denote-use-bib-keywords t) - :init - (citar-denote-mode)) diff --git a/extras/vim-like.el b/extras/vim-like.el deleted file mode 100644 index d6a8db6..0000000 --- a/extras/vim-like.el +++ /dev/null @@ -1,36 +0,0 @@ -;;; Emacs Bedrock -;;; -;;; Extra config: Vim emulation - -;;; Usage: Append or require this file from init.el for bindings in Emacs. - -;;; Contents: -;;; -;;; - Core Packages - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Core Packages -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; Evil: vi emulation -(use-package evil - :ensure t - - :init - (setq evil-respect-visual-line-mode t) - (setq evil-undo-system 'undo-redo) - - ;; Enable this if you want C-u to scroll up, more like pure Vim - ;(setq evil-want-C-u-scroll t) - - :config - (evil-mode) - - ;; If you use Magit, start editing in insert state - (add-hook 'git-commit-setup-hook 'evil-insert-state) - - ;; Configuring initial major mode for some modes - (evil-set-initial-state 'eat-mode 'emacs) - (evil-set-initial-state 'vterm-mode 'emacs)) diff --git a/extras/writer.el b/extras/writer.el deleted file mode 100644 index 3fe801c..0000000 --- a/extras/writer.el +++ /dev/null @@ -1,62 +0,0 @@ -;;; Emacs Bedrock -;;; -;;; Extra config: Writer - -;;; Usage: Append or require this file from init.el for writing aids. -;;; -;;; Jinx is a spell-checking package that is performant and flexible. -;;; You can use Jinx inside of programming modes and it will only -;;; check spelling inside of strings and comments. (Configurable, of -;;; course.) It also supports having multiple languages (e.g. English -;;; and German) in the same file. -;;; -;;; Olivetti narrows the window margins so that your text is centered. -;;; This makes writing in a wide, dedicated window more pleasant. -;;; -;;; NOTE: the Olivetti package lives on the MELPA repository; you will -;;; need to update the `package-archives' variable in init.el before -;;; before loading this file; see the comment in init.el under -;;; "Package initialization". - -;;; Contents: -;;; -;;; - Spell checking -;;; - Dictionary -;;; - Distraction mitigation - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Spell checking -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; Jinx: Enchanted spell-checking -(use-package jinx - :ensure t - :hook (((text-mode prog-mode) . jinx-mode)) - :bind (("C-;" . jinx-correct)) - :custom - (jinx-camel-modes '(prog-mode)) - (jinx-delay 0.01)) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Dictionary -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(setopt dictionary-use-single-buffer t) -(setopt dictionary-server "dict.org") - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Distraction mitigation -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; Olivetti: Set the window margins so your text is centered -(use-package olivetti - :ensure t - ;; Uncomment below to make olivetti-mode turn on automatically in certain modes - ; :hook ((markdown-mode . olivetti-mode)) - ) diff --git a/init.el b/init.el deleted file mode 100644 index cba11c8..0000000 --- a/init.el +++ /dev/null @@ -1,256 +0,0 @@ -;;; ________ _______ __ __ -;;; / | / \ / | / | -;;; $$$$$$$$/ _____ ____ ______ _______ _______ $$$$$$$ | ______ ____$$ | ______ ______ _______$$ | __ -;;; $$ |__ / \/ \ / \ / |/ | $$ |__$$ |/ \ / $$ |/ \ / \ / $$ | / | -;;; $$ | $$$$$$ $$$$ |$$$$$$ /$$$$$$$//$$$$$$$/ $$ $$</$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$$/$$ |_/$$/ -;;; $$$$$/ $$ | $$ | $$ |/ $$ $$ | $$ \ $$$$$$$ $$ $$ $$ | $$ $$ | $$/$$ | $$ $$ | $$ $$< -;;; $$ |_____$$ | $$ | $$ /$$$$$$$ $$ \_____ $$$$$$ | $$ |__$$ $$$$$$$$/$$ \__$$ $$ | $$ \__$$ $$ \_____$$$$$$ \ -;;; $$ $$ | $$ | $$ $$ $$ $$ / $$/ $$ $$/$$ $$ $$ $$ | $$ $$/$$ $$ | $$ | -;;; $$$$$$$$/$$/ $$/ $$/ $$$$$$$/ $$$$$$$/$$$$$$$/ $$$$$$$/ $$$$$$$/ $$$$$$$/$$/ $$$$$$/ $$$$$$$/$$/ $$/ - -;;; Minimal init.el - -;;; Contents: -;;; -;;; - Basic settings -;;; - Discovery aids -;;; - Minibuffer/completion settings -;;; - Interface enhancements/defaults -;;; - Tab-bar configuration -;;; - Theme -;;; - Optional extras -;;; - Built-in customization framework - -;;; Guardrail - -(when (< emacs-major-version 29) - (error "Emacs Bedrock only works with Emacs 29 and newer; you have version %s" emacs-major-version)) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Basic settings -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; Package initialization -;; -;; We'll stick to the built-in GNU and non-GNU ELPAs (Emacs Lisp Package -;; Archive) for the base install, but there are some other ELPAs you could look -;; at if you want more packages. MELPA in particular is very popular. See -;; instructions at: -;; -;; https://melpa.org/#/getting-started -;; -;; You can simply uncomment the following if you'd like to get started with -;; MELPA packages quickly: -;; -;; (with-eval-after-load 'package -;; (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)) - -;; If you want to turn off the welcome screen, uncomment this -;(setopt inhibit-splash-screen t) - -(setopt initial-major-mode 'fundamental-mode) ; default mode for the *scratch* buffer -(setopt display-time-default-load-average nil) ; this information is useless for most - -;; Automatically reread from disk if the underlying file changes -(setopt auto-revert-avoid-polling t) -;; Some systems don't do file notifications well; see -;; https://todo.sr.ht/~ashton314/emacs-bedrock/11 -(setopt auto-revert-interval 5) -(setopt auto-revert-check-vc-info t) -(global-auto-revert-mode) - -;; Save history of minibuffer -(savehist-mode) - -;; Move through windows with Ctrl-<arrow keys> -(windmove-default-keybindings 'control) ; You can use other modifiers here - -;; Fix archaic defaults -(setopt sentence-end-double-space nil) - -;; Make right-click do something sensible -(when (display-graphic-p) - (context-menu-mode)) - -;; Don't litter file system with *~ backup files; put them all inside -;; ~/.emacs.d/backup or wherever -(defun bedrock--backup-file-name (fpath) - "Return a new file path of a given file path. -If the new path's directories does not exist, create them." - (let* ((backupRootDir (concat user-emacs-directory "emacs-backup/")) - (filePath (replace-regexp-in-string "[A-Za-z]:" "" fpath )) ; remove Windows driver letter in path - (backupFilePath (replace-regexp-in-string "//" "/" (concat backupRootDir filePath "~") ))) - (make-directory (file-name-directory backupFilePath) (file-name-directory backupFilePath)) - backupFilePath)) -(setopt make-backup-file-name-function 'bedrock--backup-file-name) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Discovery aids -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; Show the help buffer after startup -(add-hook 'after-init-hook 'help-quick) - -;; which-key: shows a popup of available keybindings when typing a long key -;; sequence (e.g. C-x ...) -(use-package which-key - :ensure t - :config - (which-key-mode)) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Minibuffer/completion settings -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; For help, see: https://www.masteringemacs.org/article/understanding-minibuffer-completion - -(setopt enable-recursive-minibuffers t) ; Use the minibuffer whilst in the minibuffer -(setopt completion-cycle-threshold 1) ; TAB cycles candidates -(setopt completions-detailed t) ; Show annotations -(setopt tab-always-indent 'complete) ; When I hit TAB, try to complete, otherwise, indent -(setopt completion-styles '(basic initials substring)) ; Different styles to match input to candidates - -(setopt completion-auto-help 'always) ; Open completion always; `lazy' another option -(setopt completions-max-height 20) ; This is arbitrary -(setopt completions-detailed t) -(setopt completions-format 'one-column) -(setopt completions-group t) -(setopt completion-auto-select 'second-tab) ; Much more eager -;(setopt completion-auto-select t) ; See `C-h v completion-auto-select' for more possible values - -(keymap-set minibuffer-mode-map "TAB" 'minibuffer-complete) ; TAB acts more like how it does in the shell - -;; For a fancier built-in completion option, try ido-mode, -;; icomplete-vertical, or fido-mode. See also the file extras/base.el - -;(icomplete-vertical-mode) -;(fido-vertical-mode) -;(setopt icomplete-delay-completions-threshold 4000) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Interface enhancements/defaults -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; Mode line information -(setopt line-number-mode t) ; Show current line in modeline -(setopt column-number-mode t) ; Show column as well - -(setopt x-underline-at-descent-line nil) ; Prettier underlines -(setopt switch-to-buffer-obey-display-actions t) ; Make switching buffers more consistent - -(setopt show-trailing-whitespace nil) ; By default, don't underline trailing spaces -(setopt indicate-buffer-boundaries 'left) ; Show buffer top and bottom in the margin - -;; Enable horizontal scrolling -(setopt mouse-wheel-tilt-scroll t) -(setopt mouse-wheel-flip-direction t) - -;; We won't set these, but they're good to know about -;; -;; (setopt indent-tabs-mode nil) -;; (setopt tab-width 4) - -;; Misc. UI tweaks -(blink-cursor-mode -1) ; Steady cursor -(pixel-scroll-precision-mode) ; Smooth scrolling - -;; Use common keystrokes by default -(cua-mode) - -;; Display line numbers in programming mode -(add-hook 'prog-mode-hook 'display-line-numbers-mode) -(setopt display-line-numbers-width 3) ; Set a minimum width - -;; Nice line wrapping when working with text -(add-hook 'text-mode-hook 'visual-line-mode) - -;; Modes to highlight the current line with -(let ((hl-line-hooks '(text-mode-hook prog-mode-hook))) - (mapc (lambda (hook) (add-hook hook 'hl-line-mode)) hl-line-hooks)) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Tab-bar configuration -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; Show the tab-bar as soon as tab-bar functions are invoked -(setopt tab-bar-show 1) - -;; Add the time to the tab-bar, if visible -(add-to-list 'tab-bar-format 'tab-bar-format-align-right 'append) -(add-to-list 'tab-bar-format 'tab-bar-format-global 'append) -(setopt display-time-format "%a %F %T") -(setopt display-time-interval 1) -(display-time-mode) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Theme -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(use-package emacs - :config - (load-theme 'modus-vivendi)) ; for light theme, use modus-operandi - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Optional extras -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; Uncomment the (load-file …) lines or copy code from the extras/ elisp files -;; as desired - -;; UI/UX enhancements mostly focused on minibuffer and autocompletion interfaces -;; These ones are *strongly* recommended! -;(load-file (expand-file-name "extras/base.el" user-emacs-directory)) - -;; Packages for software development -;(load-file (expand-file-name "extras/dev.el" user-emacs-directory)) - -;; Vim-bindings in Emacs (evil-mode configuration) -;(load-file (expand-file-name "extras/vim-like.el" user-emacs-directory)) - -;; Org-mode configuration -;; WARNING: need to customize things inside the elisp file before use! See -;; the file extras/org-intro.txt for help. -;(load-file (expand-file-name "extras/org.el" user-emacs-directory)) - -;; Email configuration in Emacs -;; WARNING: needs the `mu' program installed; see the elisp file for more -;; details. -;(load-file (expand-file-name "extras/email.el" user-emacs-directory)) - -;; Tools for academic researchers -;(load-file (expand-file-name "extras/researcher.el" user-emacs-directory)) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Built-in customization framework -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(package-selected-packages '(which-key))) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - ) - -(setq gc-cons-threshold (or bedrock--initial-gc-threshold 800000)) diff --git a/substrate.el b/substrate.el new file mode 100644 index 0000000..6dc93a5 --- /dev/null +++ b/substrate.el @@ -0,0 +1,228 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; .⌒. ▗▄▄▖▗ ▖ ▗▖ ▗▄ ▄▄ ▄▄ ▗ ▖▗▄▄ ▄▄ ▄▄▄▖▗▄▄ ▗▖ ▄▄▄▖▗▄▄▖ ;;; +;;; .# #. ▐ ▐▌▐▌ ▐▌ ▗▘ ▘▐▘ ▘ ▐▘ ▘▐ ▌▐ ▌▐▘ ▘ ▐ ▐ ▝▌ ▐▌ ▐ ▐ ;;; +;;; / \ ▐▄▄▖▐▐▌▌ ▌▐ ▐ ▝▙▄ ▝▙▄ ▐ ▌▐▄▄▘▝▙▄ ▐ ▐▄▄▘ ▌▐ ▐ ▐▄▄▖ ;;; +;;; (,,,___,,,) ▐ ▐▝▘▌ ▙▟ ▐ ▝▌ ▝▌▐ ▌▐ ▌ ▝▌ ▐ ▐ ▝▖ ▙▟ ▐ ▐ ;;; +;;; ) ( ▐▄▄▖▐ ▌▐ ▌ ▚▄▘▝▄▟▘ ▝▄▟▘▝▄▄▘▐▄▄▘▝▄▟▘ ▐ ▐ ▘▐ ▌ ▐ ▐▄▄▖ ;;; +;;; (___) ;;; +;;; ;;; +;;; init.el ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;;; Guardrail +(when (< emacs-major-version 29) + (error "Emacs Substrate only works with Emacs 29 and newer; you have version %s" emacs-major-version)) + +;;; Custom variables + +(defgroup substrate nil "Custom options for substrate") +(defcustom substrate-initialise-packages t + "Initialise the substrate package system (straight.el)" + :type 'boolean :group 'substrate) +(defcustom substrate-enable-windmove t + "Enable windmove to hop around windows with ctrl+arrow" + :type 'boolean :group 'substrate) +(defcustom substrate-display-startup-help t + "Show a help window on startup" + :type 'boolean :group 'substrate) +(defcustom substrate-enable-which-key t + "Use which-key to list available key combos" + :type 'boolean :group 'substrate) +(defcustom substrate-display-line-numbers t + "Display line numbers on buffers" + :type 'boolean :group 'substrate) +(defcustom substrate-enable-cua-mode t + "Enable CUA mode or not" + :type 'boolean :group 'substrate) +(defcustom substrate-configure-theme t + "Configure the default theme (evangelion) as part of the substrate init" + :type 'boolean :group 'substrate) + + +(defun substrate-init () + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;;; + ;;; Basic settings + ;;; + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + ;; Package initialization + ;; + (when substrate-initialise-packages + (defvar bootstrap-version) + (let ((bootstrap-file + (expand-file-name + "straight/repos/straight.el/bootstrap.el" + (or (bound-and-true-p straight-base-dir) + user-emacs-directory))) + (bootstrap-version 7)) + (unless (file-exists-p bootstrap-file) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) + (load bootstrap-file nil 'nomessage) + (setq straight-use-package-by-default t))) + + (setopt initial-major-mode 'fundamental-mode) ; default mode for the *scratch* buffer + (setopt display-time-default-load-average nil) ; this information is useless for most + + ;; Automatically reread from disk if the underlying file changes + (setopt auto-revert-avoid-polling t) + ;; Some systems don't do file notifications well; see + ;; https://todo.sr.ht/~ashton314/emacs-bedrock/11 + (setopt auto-revert-interval 5) + (setopt auto-revert-check-vc-info t) + (global-auto-revert-mode) + + ;; Save history of minibuffer + (savehist-mode) + + ;; Move through windows with Ctrl-<arrow keys> + (when substrate-enable-windmove + (windmove-default-keybindings 'control)) ; You can use other modifiers here + + ;; Fix archaic defaults + (setopt sentence-end-double-space nil) + + ;; Make right-click do something sensible + (when (display-graphic-p) + (context-menu-mode)) + + ;; Don't litter file system with *~ backup files; put them all inside + ;; ~/.emacs.d/backup or wherever + (defun substrate--backup-file-name (fpath) + "Return a new file path of a given file path. +If the new path's directories does not exist, create them." + (let* ((backupRootDir (concat user-emacs-directory "emacs-backup/")) + (filePath (replace-regexp-in-string "[A-Za-z]:" "" fpath )) ; remove Windows driver letter in path + (backupFilePath (replace-regexp-in-string "//" "/" (concat backupRootDir filePath "~") ))) + (make-directory (file-name-directory backupFilePath) (file-name-directory backupFilePath)) + backupFilePath)) + (setopt make-backup-file-name-function 'substrate--backup-file-name) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Discovery aids +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + ;; Show the help buffer after startup + (when substrate-display-startup-help + (add-hook 'after-init-hook 'help-quick)) + + ;; which-key: shows a popup of available keybindings when typing a long key + ;; sequence (e.g. C-x ...) + (use-package which-key + :ensure t + :if substrate-enable-which-key + :config + (which-key-mode)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Minibuffer/completion settings +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + ;; For help, see: https://www.masteringemacs.org/article/understanding-minibuffer-completion + + (setopt enable-recursive-minibuffers t) ; Use the minibuffer whilst in the minibuffer + (setopt completion-cycle-threshold 1) ; TAB cycles candidates + (setopt completions-detailed t) ; Show annotations + (setopt tab-always-indent 'complete) ; When I hit TAB, try to complete, otherwise, indent + (setopt completion-styles '(basic initials substring)) ; Different styles to match input to candidates + + (setopt completion-auto-help 'always) ; Open completion always; `lazy' another option + (setopt completions-max-height 20) ; This is arbitrary + (setopt completions-detailed t) + (setopt completions-format 'one-column) + (setopt completions-group t) + (setopt completion-auto-select 'second-tab) ; Much more eager + ;(setopt completion-auto-select t) ; See `C-h v completion-auto-select' for more possible values + + (keymap-set minibuffer-mode-map "TAB" 'minibuffer-complete) ; TAB acts more like how it does in the shell + + ;; For a fancier built-in completion option, try ido-mode, + ;; icomplete-vertical, or fido-mode. See also the file extras/base.el + + ;(icomplete-vertical-mode) + ;(fido-vertical-mode) + ;(setopt icomplete-delay-completions-threshold 4000) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Interface enhancements/defaults +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + ;; Mode line information + (setopt line-number-mode t) ; Show current line in modeline + (setopt column-number-mode t) ; Show column as well + + (setopt x-underline-at-descent-line nil) ; Prettier underlines + (setopt switch-to-buffer-obey-display-actions t) ; Make switching buffers more consistent + + (setopt show-trailing-whitespace nil) ; By default, don't underline trailing spaces + (setopt indicate-buffer-boundaries 'left) ; Show buffer top and bottom in the margin + + ;; Enable horizontal scrolling + (setopt mouse-wheel-tilt-scroll t) + (setopt mouse-wheel-flip-direction t) + + ;; We won't set these, but they're good to know about + ;; + ;; (setopt indent-tabs-mode nil) + ;; (setopt tab-width 4) + + ;; Misc. UI tweaks + (blink-cursor-mode -1) ; Steady cursor + (pixel-scroll-precision-mode) ; Smooth scrolling + + ;; Use common keystrokes by default + (when substrate-enable-cua-mode + (cua-mode)) + + ;; Display line numbers in programming mode + (when substrate-display-line-numbers + (add-hook 'prog-mode-hook 'display-line-numbers-mode) + (setopt display-line-numbers-width 3)) ; Set a minimum width + + ;; Nice line wrapping when working with text + (add-hook 'text-mode-hook 'visual-line-mode) + + ;; Modes to highlight the current line with + (let ((hl-line-hooks '(text-mode-hook prog-mode-hook))) + (mapc (lambda (hook) (add-hook hook 'hl-line-mode)) hl-line-hooks)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Tab-bar configuration +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + ;; Show the tab-bar as soon as tab-bar functions are invoked + (setopt tab-bar-show 1) + + ;; Add the time to the tab-bar, if visible + (add-to-list 'tab-bar-format 'tab-bar-format-align-right 'append) + (add-to-list 'tab-bar-format 'tab-bar-format-global 'append) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; Theme +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + (use-package evangelion-theme + :if substrate-configure-theme + :config (load-theme 'evangelion t)) + +;;; Relegate automatic custom variables to their own file. + (setq custom-file (expand-file-name "custom-vars.el")) + +) ;; End substrate-init + +(provide 'substrate) +;;; End of substrate.el |