commit f7b2b6448ece01abff443194f8f0a079f5796c3e from: mtmn date: Mon Jul 20 06:18:56 2026 UTC make more evil, denote and org, binds, etc. commit - b3be9eadc20075abcb91089548f3eeefc084fe47 commit + f7b2b6448ece01abff443194f8f0a079f5796c3e blob - c4dd4c5b100512f3034f343edf66e3c5b4be5d4a blob + ae2c346fd96231deab35fb488636f7d26bb9ab48 --- .gitignore +++ .gitignore @@ -7,3 +7,6 @@ /projects /transient/ /tree-sitter/ +/recentf +/emacs-backup +/bookmarks blob - af400d28cd3c379f6b41dbb74369fc719c723c2d blob + 2839b7b731705ca459a0af00db908d6ca610394d --- LICENSE +++ LICENSE @@ -1,7 +1,8 @@ Copyright © 2023 Ashton Wiersdorf +Copyright © 2026 mtmn Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. blob - 6e927335c8adb5f28f097b2500c24ca61f2fcd63 blob + 484e6fb55de85eb718970acacd03a10aee071f70 --- README.md +++ README.md @@ -1,337 +1,12 @@ -# Emacs Bedrock +# emacs -Stepping stones to a better Emacs experience +Somewhat minimal and evilified configuration set based on [emacs-bedrock]( https://codeberg.org/ashton314/emacs-bedrock). -## Synopsis +## Usage -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) - -**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: - - - 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. - - - No magic - - We keep things *crushingly* simple here. That means no fancy loadable modules or whatnot. Everything is as straight-forward as can be. - -There are two files of interest: `early-init.el` and `init.el`. - -### `early-init.el` - -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: - - - 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.) - -### Trying this out without committing too hard - -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`. - -Once you're happy, you should just copy `init.el` and `early-init.el` to `~/.emacs.d/`. - -## Screenshots - -What you should see on opening Emacs up with Bedrock installed: a simple splash screen, [modus-vivendi](https://protesilaos.com/emacs/modus-themes) active, and the `help-quick` display at the bottom. - -![Emacs using Bedrock configuration showing the splash screen with the quick help at the bottom](screenshots/basic_splash.png) - -Basic code editing: line numbers and `hl-line-mode`. - -![Editing the source code of Emacs Bedrock's init.el file while using Bedrock configuration](screenshots/basic_code_editing.png) - -`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. - -![Which key package in motion](screenshots/which_key.gif) - -[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.) - -![Still from the built-in completion interface, new with Emacs 29.1](screenshots/basic_builtin_completion.png) - -Basic completion interface in action. - -![GIF of the completion interface in action](screenshots/basic_completion.gif) - -[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) - - [TempEL](https://github.com/minad/tempel) - - 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. - -TempEL is a lightweight template library. Bedrock comes with a few templates provided in the TempEL README. Try opening a text file, type `shrug`, then hit `M-+` to expand that template. Templates are defined in `templates`, but this can be moved around by configuring `tempel-path`. - -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. Emacs 31 should have some utilities to make this less of a headache. - -#### 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` - -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/ +```sh +git clone https://git.sr.ht/~mtmn/emacs ~/.config/emacs +emacs --tty ``` -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. - -> …Freely ye have received, freely give… - -## Requirements - -Emacs 29.1 or later. - -Emacs 29.1 is, as of 2023-09-04, the latest stable release. The specific features from Emacs 29.1 that Bedrock relies on are: - - - The `use-package` macro for configuration - - Enhancements to the built-in completion help (`completions-auto-select`, `completion-auto-help`, etc.) - - Built-in tree-sitter support - - Built-in LSP client (Eglot) - -## Development - -This is version `1.5.0`. - -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://codeberg.org/ashton314/emacs-bedrock/issues) 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.5.0 - - Add TempEL to `extras/dev.el`. - - Add a few small things specific to Emacs 30: turn on `visual-wrap-prefix-mode` and `project-mode-line`. - - Miscellaneous bug fixes. - - - 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 - -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/ +Run and profit. blob - 4f5e0a0b501fa7f8653547ae848302e6767d69fd blob + a86726932891d104b1d7838e2ad977136097a1ca --- early-init.el +++ early-init.el @@ -1,43 +1,12 @@ -;;; ________ _______ __ __ -;;; / | / \ / | / | -;;; $$$$$$$$/ _____ ____ ______ _______ _______ $$$$$$$ | ______ ____$$ | ______ ______ _______$$ | __ -;;; $$ |__ / \/ \ / \ / |/ | $$ |__$$ |/ \ / $$ |/ \ / \ / $$ | / | -;;; $$ | $$$$$$ $$$$ |$$$$$$ /$$$$$$$//$$$$$$$/ $$ $$= emacs-major-version 30) - (project-mode-line t))) ; show project name in modeline - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; 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 - :ensure t - :hook ((markdown-mode . visual-line-mode))) - -(use-package yaml-mode - :ensure t) - -(use-package json-mode - :ensure t) - -(use-package nix-mode - :ensure t - :mode "\\.nix\\'") - -;; 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-ensure)) - - :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"))) - ) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Templating -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(use-package tempel - :ensure t - ;; By default, tempel looks at the file "templates" in - ;; user-emacs-directory, but you can customize that with the - ;; tempel-path variable: - ;; :custom - ;; (tempel-path (concat user-emacs-directory "custom_template_file")) - :bind (("M-*" . tempel-insert) - ("M-+" . tempel-complete) - :map tempel-map - ("C-c RET" . tempel-done) - ("C-" . tempel-next) - ("C-" . tempel-previous) - ("M-" . tempel-next) - ("M-" . tempel-previous)) - :init - ;; Make a function that adds the tempel expansion function to the - ;; list of completion-at-point-functions (capf). - (defun tempel-setup-capf () - (add-hook 'completion-at-point-functions #'tempel-expand -1 'local)) - ;; Put tempel-expand on the list whenever you start programming or - ;; writing prose. - (add-hook 'prog-mode-hook 'tempel-setup-capf) - (add-hook 'text-mode-hook 'tempel-setup-capf)) blob - /dev/null blob + 42e3723a6920036c2193a2e122e9574e9a37385e (mode 644) --- /dev/null +++ extras/binds.el @@ -0,0 +1,45 @@ +;;; extras/binds.el --- Key bindings -*- lexical-binding: t; -*- + +(defvar-keymap mine-leader-map + :doc "Leader key map for SPC bindings.") + +(with-eval-after-load 'evil + (evil-define-key '(normal visual) 'global (kbd "SPC") mine-leader-map)) + +(keymap-set mine-leader-map "f f" #'project-find-file) +(keymap-set mine-leader-map "f h" #'consult-recent-file) +(keymap-set mine-leader-map "f g" #'consult-ripgrep) + +(keymap-set mine-leader-map "g g" #'magit-status) + +(keymap-set mine-leader-map "g d" #'xref-find-definitions) +(keymap-set mine-leader-map "g D" #'xref-find-definitions-other-window) +(keymap-set mine-leader-map "g i" #'eglot-find-implementation) +(keymap-set mine-leader-map "g t" #'eglot-find-typeDefinition) +(keymap-set mine-leader-map "g r" #'xref-find-references) +(keymap-set mine-leader-map "g s" #'eldoc-doc-buffer) +(keymap-set mine-leader-map "g a" #'eglot-code-actions) +(keymap-set mine-leader-map "g l" #'consult-flymake) +(keymap-set mine-leader-map "g p" #'flymake-goto-prev-error) +(keymap-set mine-leader-map "g n" #'flymake-goto-next-error) + +(keymap-set mine-leader-map "r r" #'eglot-rename) +(keymap-set mine-leader-map "t r" #'consult-imenu) + +(defun mine-eglot-format-visual () + "Format the active region or current buffer via Eglot." + (interactive) + (if (use-region-p) + (eglot-format-region (region-beginning) (region-end)) + (eglot-format))) +(with-eval-after-load 'evil + (evil-define-key 'visual 'global (kbd "SPC g f") #'mine-eglot-format-visual)) + +(with-eval-after-load 'corfu + (keymap-set corfu-map "C-b" #'corfu-scroll-down) + (keymap-set corfu-map "C-f" #'corfu-scroll-up) + (keymap-set corfu-map "C-SPC" #'corfu-complete) + (keymap-set corfu-map "C-e" #'corfu-quit) + (keymap-set corfu-map "RET" #'corfu-complete)) + +;;; binds.el ends here blob - 2ff7dd4ba2b23bd60ef92cfa60f12c2b03677a62 (mode 644) blob + /dev/null --- 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 -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; blob - /dev/null blob + aeb8cf430a74242365ef0bc3db0fc9054b3128c9 (mode 644) --- /dev/null +++ extras/core.el @@ -0,0 +1,13 @@ +;;; extras/core.el --- Core development settings -*- lexical-binding: t; -*- + +(setq major-mode-remap-alist + '((yaml-mode . yaml-ts-mode) + (bash-mode . bash-ts-mode) + (json-mode . json-ts-mode) + (css-mode . css-ts-mode) + (python-mode . python-ts-mode))) + +(add-hook 'prog-mode-hook #'electric-pair-mode) + +(use-package project + :custom (project-mode-line t)) blob - ca56bf49265a080f65c2e9962180d6bc3fa99dd5 (mode 644) blob + /dev/null --- 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. :) blob - /dev/null blob + 9a246f1e709f394669ced06d5499550808a77e6b (mode 644) --- /dev/null +++ extras/evil.el @@ -0,0 +1,28 @@ +;;; extras/evil.el --- Evil-mode and addons -*- lexical-binding: t; -*- + +(use-package evil + :ensure t + :custom + (evil-want-keybinding nil) + (evil-respect-visual-line-mode t) + (evil-undo-system 'undo-redo) + (evil-want-C-u-scroll t) + :config + (evil-mode) + (add-hook 'git-commit-setup-hook #'evil-insert-state) + (evil-set-initial-state 'eat-mode 'emacs)) + +(use-package evil-collection + :ensure t + :after evil + :config (evil-collection-init)) + +(use-package evil-surround + :ensure t + :after evil + :config (global-evil-surround-mode)) + +(use-package evil-commentary + :ensure t + :after evil + :config (evil-commentary-mode)) blob - 156f5f1b58ca47d71fd07f3f6085f9cffd4ef327 blob + da70b4500bc78ec281bc4a56a42a7d43780247f6 --- extras/org.el +++ extras/org.el @@ -1,161 +1,74 @@ -;;; Emacs Bedrock -;;; -;;; Extra config: Org-mode starter config +;;; extras/org.el --- Org-mode configuration -*- lexical-binding: t; -*- -;;; 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. +(setopt org-directory (expand-file-name "~/.nb/notes") + org-agenda-files (list org-directory) + org-default-notes-file (expand-file-name "todo.org" org-directory)) -;;; See "org-intro.txt" for a high-level overview. +(setopt org-refile-targets '((org-agenda-files :maxlevel . 3)) + org-refile-use-outline-path 'file + org-outline-path-complete-in-steps nil) -;;; Contents: -;;; -;;; - Critical variables -;;; - Phase 1: editing and exporting files -;;; - Phase 2: todos, agenda generation, and task tracking -;;; - Phase 3: extensions (org-roam, etc.) +(setopt org-todo-keywords + '((sequence "TODO(t)" "WAITING(w@/!)" "STARTED(s!)" "|" "DONE(d!)" "OBSOLETE(o@)")) + org-log-done 'time + org-log-into-drawer t) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Critical variables -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(setopt org-capture-templates + '(("c" "todo" entry (file+headline org-default-notes-file "Tasks") + "* TODO %? +%U +%i") + ("r" "capture" entry (file+headline org-default-notes-file "Tasks") + "* TODO %? +%U +%i +%a"))) -;;; 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. +(setopt org-agenda-start-with-log-mode 'clockcheck + org-agenda-prefix-format + '((agenda . " %i %-12:c%?-12t% s") + (todo . " %i %-12:c") + (tags . " %i %-12:c") + (search . " %i %-12:c")) + org-agenda-time-grid + '((daily today require-timed) + (800 1000 1200 1400 1600 1800 2000) + " ┄┄┄┄┄ " "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄") + org-agenda-current-time-string "◀── now") -;;; Phase 1 variables +(setopt org-special-ctrl-a/e t + org-special-ctrl-k t + org-return-follows-link t + org-image-actual-width nil + org-startup-with-inline-images t + org-hide-emphasis-markers t) -;;; Phase 2 variables +(setopt org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id + org-link-abbrev-alist + '(("family_search" . "https://www.familysearch.org/tree/person/details/%s"))) -;; Agenda variables -(setq org-directory "~/.nb/notes") ; Non-absolute paths for agenda and - ; capture templates will look here. +(setopt org-export-with-smart-quotes t) -(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 "~/.nb/notes") -(setq org-roam-index-file "~/.nb/notes/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! - + :hook ((org-mode . visual-line-mode) + (org-mode . flyspell-mode) + (org-mode . variable-pitch-mode)) :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 + ("C-c l s" . org-store-link) + ("C-c l i" . org-insert-link-global) + ("C-c a" . org-agenda) + ("C-c c" . org-capture)) :config - (require 'oc-csl) ; citation support + (require 'oc-csl) (add-to-list 'org-export-backends 'md) + (setf (alist-get 'file org-link-frame-setup) 'find-file) + (setopt org-startup-indented t + org-cycle-separator-lines 2)) - ;; 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 +(use-package evil-org + :ensure t + :after org + :hook (org-mode . evil-org-mode) :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 + (require 'evil-org-agenda) + (evil-org-agenda-set-keys)) blob - /dev/null blob + f69c7c3aaa2b4423e15759f2f102a4e6f68f918d (mode 644) --- /dev/null +++ extras/lang.el @@ -0,0 +1,17 @@ +;;; extras/langs.el --- Programming language modes -*- lexical-binding: t; -*- + +(use-package yaml-mode + :ensure t) + +(use-package json-mode + :ensure t) + +(use-package nix-mode + :ensure t + :mode "\\.nix\\'") + +(use-package go-mode + :ensure t) + +(use-package zig-mode + :ensure t) blob - b65a998587d3b443aa8b4f95f4228c5d2d089f39 (mode 644) blob + /dev/null --- extras/researcher.el +++ /dev/null @@ -1,135 +0,0 @@ -;;; Emacs Bedrock -;;; -;;; Extra config: Researcher - -;;; 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". -;;; -;;; 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. -;;; -;;; 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 -;; -;; The denote package itself provides the core of the file -;; naming/tagging scheme. There are a handful of extra packages that -;; provide additional utilities: -;; -;; - denote-journal: create daily notes -;; -;; - denote-sequence: create "folgezettle", i.e. hierarchy/sequences -;; of related notes -;; -;; - denote-markdown: utilities to make denote work smoother with -;; markdown-type files -;; -;; - denote-silo: create separate "silos" of notes that live in -;; different directories -;; -;; Each package is thoughtfully crafted and exceptionally -;; well-documented, as is typical with any package written by -;; Protesilaos "Prot" Stavrou. - -(use-package denote - :custom - ;; Default file type. Accepts 'text 'markdown-yaml 'markdown-toml - (denote-file-type 'org) - :config - (denote-rename-buffer-mode)) - -(use-package denote-journal - :after denote - :custom - ;; Other good variables to configure: denote-journal-directory, denote-journal-title-format - (denote-journal-keyword "journal")) - -(use-package denote-markdown - :after denote) - -(use-package denote-sequence - :after denote) - -(use-package denote-silo - :after denote) - -;; 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)) blob - /dev/null blob + 1de67efe207a7b3e171760170c7fa427d89d8436 (mode 644) --- /dev/null +++ extras/lisp.el @@ -0,0 +1,12 @@ +;;; extras/lisp.el --- SLIME / Common Lisp support -*- lexical-binding: t; -*- + +(use-package slime + :ensure t + :custom + (inferior-lisp-program "sbcl") + (slime-lisp-implementations '((sbcl ("sbcl")))) + :bind (:map slime-mode-map + ("C-c C-d C-s" . slime-describe-symbol) + ("C-c C-d C-a" . slime-apropos)) + :config + (slime-setup '(slime-fancy slime-quicklisp slime-asdf))) blob - ad200dea0e7dea7891364c70059a70b846c10e90 (mode 644) blob + /dev/null --- 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)) blob - /dev/null blob + c98160b3fa3f12f1f67a03f1b2ec36daa3957f1d (mode 644) --- /dev/null +++ extras/lsp.el @@ -0,0 +1,7 @@ +;;; extras/lsp.el --- Language server protocol -*- lexical-binding: t; -*- + +(use-package eglot + :custom + (eglot-send-changes-idle-time 0.1) + (eglot-extend-to-xref t) + :config (fset #'jsonrpc--log-event #'ignore)) blob - 9f2be5f3205225cf8ae743f76924d76c58e78644 (mode 644) blob + /dev/null --- extras/writer.el +++ /dev/null @@ -1,71 +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 - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; General prose-friendly behavior -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(when (>= emacs-major-version 30) ; compat test - (add-hook 'text-mode-hook 'visual-wrap-prefix-mode)) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; 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)) - ) blob - /dev/null blob + d15ace9d1ff285628e0b7d71b3acdbf885178bd4 (mode 644) --- /dev/null +++ extras/magit.el @@ -0,0 +1,5 @@ +;;; extras/magit.el --- Magit -*- lexical-binding: t; -*- + +(use-package magit + :ensure t + :bind (("C-x g" . magit-status))) blob - /dev/null blob + c31175b9bed89681ec13eaf7086a9a669bf8d835 (mode 644) --- /dev/null +++ extras/markdown.el @@ -0,0 +1,5 @@ +;;; extras/markdown.el --- Markdown -*- lexical-binding: t; -*- + +(use-package markdown-mode + :ensure t + :hook (markdown-mode . visual-line-mode)) blob - /dev/null blob + 463a9cb4dfca268234e7408ac92187d381b6396b (mode 644) --- /dev/null +++ extras/mine.el @@ -0,0 +1,20 @@ +;;; extras/mine.el --- Personal settings -*- lexical-binding: t; -*- + +(setopt select-enable-clipboard t + select-enable-primary t + save-interprogram-text-before-kill t) + +(use-package clipetty + :ensure t + :hook (after-init . clipetty-mode)) + +(with-eval-after-load 'eglot + (add-to-list 'eglot-server-programs + '(purescript-mode . ("pnpx" "purescript-language-server" "--stdio"))) + (add-to-list 'eglot-server-programs + '((markdown-mode text-mode tex-mode typst-mode org-mode) + . ("harper-ls" "--stdio")))) + +(use-package zoom-window + :ensure t + :bind ("C-x z" . zoom-window-zoom)) blob - /dev/null blob + 5aaef98dd33e40a045dfb166ad3d02866d827984 (mode 644) --- /dev/null +++ extras/notes.el @@ -0,0 +1,16 @@ +;;; extras/notes.el --- bare denote config -*- lexical-binding: t; -*- + +(setopt denote-directory (expand-file-name "~/.nb/notes")) + +(use-package denote + :ensure t + :custom + (denote-file-type 'org) + :config + (denote-rename-buffer-mode)) + +(use-package denote-journal + :ensure t + :after denote + :custom + (denote-journal-keyword "journal")) blob - /dev/null blob + de87d08f4cdf099be90854258aff226dd27cecfb (mode 644) --- /dev/null +++ extras/tempel.el @@ -0,0 +1,16 @@ +;;; extras/tempel.el --- Templating -*- lexical-binding: t; -*- + +(use-package tempel + :ensure t + :bind (("M-*" . tempel-insert) + ("M-+" . tempel-complete) + :map tempel-map + ("C-c RET" . tempel-done) + ("M-" . tempel-next) + ("M-" . tempel-previous)) + :init + (defun tempel-setup-capf () + "Add `tempel-expand' to `completion-at-point-functions' locally." + (add-hook 'completion-at-point-functions #'tempel-expand -1 'local)) + (add-hook 'prog-mode-hook #'tempel-setup-capf) + (add-hook 'text-mode-hook #'tempel-setup-capf)) blob - 21a16c354ceac157bf9f2e6fa670d4eef7071fb9 blob + d27fd0bba71c7d0fc0147e910206741317c3f134 --- init.el +++ init.el @@ -1,268 +1,131 @@ -;;; ________ _______ __ __ -;;; / | / \ / | / | -;;; $$$$$$$$/ _____ ____ ______ _______ _______ $$$$$$$ | ______ ____$$ | ______ ______ _______$$ | __ -;;; $$ |__ / \/ \ / \ / |/ | $$ |__$$ |/ \ / $$ |/ \ / \ / $$ | / | -;;; $$ | $$$$$$ $$$$ |$$$$$$ /$$$$$$$//$$$$$$$/ $$ $$ -(windmove-default-keybindings 'control) ; You can use other modifiers here +(windmove-default-keybindings 'control) -;; 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) + "Return a backup path for FPATH, creating parent dirs if needed." + (let* ((backup-root-dir (concat user-emacs-directory "emacs-backup/")) + (file-path (replace-regexp-in-string "[A-Za-z]:" "" fpath)) + (backup-file-path (replace-regexp-in-string + "//" "/" + (concat backup-root-dir file-path "~")))) + (make-directory (file-name-directory backup-file-path) t) + backup-file-path)) +(setopt make-backup-file-name-function #'bedrock--backup-file-name) -;; The above creates nested directories in the backup folder. If -;; instead you would like all backup files in a flat structure, albeit -;; with their full paths concatenated into a filename, then you can -;; use the following configuration: -;; (Run `'M-x describe-variable RET backup-directory-alist RET' for more help) -;; -;; (let ((backup-dir (expand-file-name "emacs-backup/" user-emacs-directory))) -;; (setopt backup-directory-alist `(("." . ,backup-dir)))) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; 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)) + :config (which-key-mode)) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Minibuffer/completion settings -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(setopt completion-cycle-threshold 3) +(setopt tab-always-indent 'complete) -;; For help, see: https://www.masteringemacs.org/article/understanding-minibuffer-completion +(keymap-set minibuffer-mode-map "TAB" #'minibuffer-complete) -(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 line-number-mode t) +(setopt column-number-mode t) -(setopt completion-auto-help 'always) ; Open completion always; `lazy' another option -(setopt completions-max-height 20) ; This is arbitrary -(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 +(setopt x-underline-at-descent-line nil) +(setopt switch-to-buffer-obey-display-actions t) -(keymap-set minibuffer-mode-map "TAB" 'minibuffer-complete) ; TAB acts more like how it does in the shell +(setopt show-trailing-whitespace nil) +(setopt indicate-buffer-boundaries 'left) -;; 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) +(blink-cursor-mode -1) +(pixel-scroll-precision-mode 1) -;; Misc. UI tweaks -(blink-cursor-mode -1) ; Steady cursor -(pixel-scroll-precision-mode) ; Smooth scrolling - -;; Use common keystrokes by default -(cua-mode) - -;; For terminal users, make the mouse more useful - +(cua-mode 1) (xterm-mouse-mode 1) -;; 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 +(add-hook 'prog-mode-hook #'display-line-numbers-mode) +(setopt display-line-numbers-width 3) -;; Nice line wrapping when working with text -(add-hook 'text-mode-hook 'visual-line-mode) +(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)) +(dolist (hook '(text-mode-hook prog-mode-hook)) + (add-hook hook #'hl-line-mode)) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; 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 +(use-package modus-themes + :ensure t + :demand t + :config + (load-theme 'modus-vivendi t)) + (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) +(display-time-mode 1) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; Theme -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(let ((auto-save-dir (expand-file-name "auto-saves/" "~/.cache/emacs")) + (lock-dir (expand-file-name "locks/" "~/.cache/emacs"))) + (make-directory auto-save-dir t) + (make-directory lock-dir t) + (setopt auto-save-file-name-transforms `((".*" ,auto-save-dir t))) + (setopt lock-file-name-transforms `((".*" ,lock-dir t)))) -(use-package emacs - :config - (load-theme 'modus-vivendi)) ; for light theme, use modus-operandi +(dolist (file '("base" + "notes" + "core" + "magit" + "markdown" + "lang" + "lsp" + "tempel" + "evil" + "org" + "binds" + "mine" + "lisp")) + (load-file (expand-file-name (format "extras/%s.el" file) user-emacs-directory))) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; -;;; 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 -;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - +(setq gc-cons-threshold (or bedrock--initial-gc-threshold 800000)) (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))) + '(package-selected-packages + '(avy cape clipetty corfu-terminal denote-journal eat eglot embark-consult + evil-collection evil-commentary evil-org evil-surround go-mode json-mode + kind-icon magit marginalia markdown-mode modus-themes nix-mode orderless + slime tempel vertico wgrep yaml-mode zig-mode zoom-window))) (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))