commit e7c71b9bf2dd17f25b3f4faa6540dfc5c9c5d8b2 from: Sara Burke date: Tue Feb 10 17:23:14 2026 UTC add emacs config commit - bb7598efa4e158cec3ce0695358ef1e221a35aca commit + e7c71b9bf2dd17f25b3f4faa6540dfc5c9c5d8b2 blob - /dev/null blob + fbf72973ff45966ef1e5962576f395c7786e95df (mode 644) --- /dev/null +++ .emacs.d/CLAUDE.md @@ -0,0 +1,71 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Overview + +This is an **Emacs Bedrock** configuration - a minimal, curated starter config based on Emacs 29+. It emphasizes built-in Emacs functionality with selective packages from GNU and non-GNU ELPAs. + +## Architecture + +### Load Order + +1. **early-init.el** - Startup optimizations, GC tuning, frame defaults, macOS appearance +2. **init.el** - Main configuration, requires Emacs 29+ +3. **extras/*.el** - Optional modules loaded via `load-file` + +### Currently Loaded Modules + +```elisp +;; In init.el, these are loaded: +(load-file (expand-file-name "extras/base.el" user-emacs-directory)) ;; UI/UX +(load-file (expand-file-name "extras/dev.el" user-emacs-directory)) ;; Development +(load-file (expand-file-name "extras/email.el" user-emacs-directory)) ;; Template only +``` + +### Available Optional Modules (commented out in init.el) + +- **vim-like.el** - Evil-mode for vi/vim keybindings +- **writer.el** - Spell checking (jinx), writing aids +- **org.el** - Org-mode configuration (requires customization) +- **researcher.el** - Citar (citations), Denote (note-taking) + +## Package Management + +- Uses built-in `use-package` macro (Emacs 29+) +- Packages from GNU ELPA and non-GNU ELPA (no MELPA by default) +- Packages stored in `elpa/` +- To add MELPA: uncomment the MELPA section in init.el + +## Key Package Stack + +**Completion/Minibuffer:** +- vertico, marginalia, orderless - Minibuffer completion +- corfu, cape - In-buffer completion +- consult, embark - Enhanced commands and context actions + +**Development:** +- magit - Git client +- eglot - LSP client (built-in) +- TreeSitter mode remapping for yaml, bash, js, ts, json, css, python + +## Custom Functions + +Only 3 custom elisp functions exist: + +1. `bedrock--backup-file-name` (init.el:30) - Backup directory structure +2. `bedrock/avy-action-embark` (extras/base.el:46) - Avy + Embark integration +3. `bedrock/setup-eshell` (extras/base.el:95) - Eshell configuration + +## Elisp Development Notes + +- Test changes: `M-x eval-buffer` or `C-x C-e` to eval expression +- Reload config: Restart Emacs or `M-x load-file RET ~/.emacs.d/init.el` +- Check for errors: `*Messages*` buffer or start with `emacs --debug-init` +- Package refresh: `M-x package-refresh-contents` + +## File Locations + +- Backups: `~/.emacs.d/emacs-backup/` +- Compiled elisp: `eln-cache/` +- Package data: `elpa/` blob - /dev/null blob + 6e16da91d7577eba00bb3b97134d11160186b7a4 (mode 644) --- /dev/null +++ .emacs.d/bsd-dark-theme.el @@ -0,0 +1,159 @@ +;;; bsd-dark-theme.el --- BSD Dark theme for Emacs -*- lexical-binding: t -*- + +;; Author: Sara +;; Version: 1.0 +;; Package-Requires: ((emacs "24.1")) +;; Keywords: faces, theme +;; URL: https://github.com/sara/bsd-dark-theme + +;; This theme is based on the Ghostty BSD Dark terminal theme. + +;;; Commentary: + +;; A dark theme with earthy, BSD-inspired colors featuring muted golds, +;; browns, and warm accents. + +;;; Code: + +(deftheme bsd-dark + "BSD Dark theme - earthy colors inspired by BSD aesthetics.") + +(let ((class '((class color) (min-colors 89))) + ;; Core colors + (bg "#14130e") + (fg "#b7a980") + (cursor "#7a7154") + (selection "#a34110") + ;; Normal colors (palette 0-7) + (black "#161510") + (red "#a32810") + (green "#727a18") + (yellow "#a37720") + (blue "#3d6266") + (magenta "#7a4a55") + (cyan "#557a55") + (white "#998d6b") + ;; Bright colors (palette 8-15) + (br-black "#4c4635") + (br-red "#cc3214") + (br-green "#8e991e") + (br-yellow "#cc9528") + (br-blue "#4c7b7f") + (br-magenta "#995b6b") + (br-cyan "#6b996b") + (br-white "#cdbc8e")) + + (custom-theme-set-faces + 'bsd-dark + + ;; Basic faces + `(default ((,class (:foreground ,fg :background ,bg)))) + `(cursor ((,class (:background ,cursor)))) + `(region ((,class (:background ,selection)))) + `(highlight ((,class (:background ,br-black)))) + `(hl-line ((,class (:background ,black)))) + `(fringe ((,class (:background ,bg :foreground ,br-black)))) + `(vertical-border ((,class (:foreground ,br-black)))) + `(border ((,class (:background ,br-black)))) + `(shadow ((,class (:foreground ,br-black)))) + + ;; Mode line + `(mode-line ((,class (:foreground ,br-white :background ,black :box (:line-width 1 :color ,br-black))))) + `(mode-line-inactive ((,class (:foreground ,white :background ,bg :box (:line-width 1 :color ,br-black))))) + `(mode-line-buffer-id ((,class (:foreground ,br-yellow :weight bold)))) + `(mode-line-emphasis ((,class (:foreground ,br-white :weight bold)))) + + ;; Font lock (syntax highlighting) + `(font-lock-builtin-face ((,class (:foreground ,br-blue)))) + `(font-lock-comment-face ((,class (:foreground ,br-black)))) + `(font-lock-comment-delimiter-face ((,class (:foreground ,br-black)))) + `(font-lock-constant-face ((,class (:foreground ,br-magenta)))) + `(font-lock-doc-face ((,class (:foreground ,green)))) + `(font-lock-function-name-face ((,class (:foreground ,br-yellow)))) + `(font-lock-keyword-face ((,class (:foreground ,br-red)))) + `(font-lock-negation-char-face ((,class (:foreground ,red)))) + `(font-lock-preprocessor-face ((,class (:foreground ,magenta)))) + `(font-lock-regexp-grouping-backslash ((,class (:foreground ,yellow)))) + `(font-lock-regexp-grouping-construct ((,class (:foreground ,magenta)))) + `(font-lock-string-face ((,class (:foreground ,br-green)))) + `(font-lock-type-face ((,class (:foreground ,br-cyan)))) + `(font-lock-variable-name-face ((,class (:foreground ,fg)))) + `(font-lock-warning-face ((,class (:foreground ,br-red :weight bold)))) + + ;; Line numbers + `(line-number ((,class (:foreground ,br-black :background ,bg)))) + `(line-number-current-line ((,class (:foreground ,br-yellow :background ,black)))) + + ;; Search + `(isearch ((,class (:foreground ,bg :background ,br-yellow)))) + `(isearch-fail ((,class (:foreground ,br-white :background ,red)))) + `(lazy-highlight ((,class (:foreground ,bg :background ,yellow)))) + + ;; Minibuffer + `(minibuffer-prompt ((,class (:foreground ,br-blue :weight bold)))) + + ;; Links + `(link ((,class (:foreground ,br-blue :underline t)))) + `(link-visited ((,class (:foreground ,br-magenta :underline t)))) + + ;; Errors, warnings, success + `(error ((,class (:foreground ,br-red :weight bold)))) + `(warning ((,class (:foreground ,br-yellow :weight bold)))) + `(success ((,class (:foreground ,br-green :weight bold)))) + + ;; Parentheses matching + `(show-paren-match ((,class (:foreground ,bg :background ,br-cyan)))) + `(show-paren-mismatch ((,class (:foreground ,bg :background ,br-red)))) + + ;; Completions + `(completions-common-part ((,class (:foreground ,br-blue)))) + `(completions-first-difference ((,class (:foreground ,br-yellow :weight bold)))) + + ;; Dired + `(dired-directory ((,class (:foreground ,br-blue :weight bold)))) + `(dired-symlink ((,class (:foreground ,br-cyan)))) + `(dired-ignored ((,class (:foreground ,br-black)))) + + ;; Org mode + `(org-level-1 ((,class (:foreground ,br-yellow :weight bold)))) + `(org-level-2 ((,class (:foreground ,br-blue :weight bold)))) + `(org-level-3 ((,class (:foreground ,br-green :weight bold)))) + `(org-level-4 ((,class (:foreground ,br-magenta :weight bold)))) + `(org-level-5 ((,class (:foreground ,br-cyan :weight bold)))) + `(org-level-6 ((,class (:foreground ,br-red :weight bold)))) + `(org-level-7 ((,class (:foreground ,yellow :weight bold)))) + `(org-level-8 ((,class (:foreground ,blue :weight bold)))) + `(org-todo ((,class (:foreground ,br-red :weight bold)))) + `(org-done ((,class (:foreground ,br-green :weight bold)))) + `(org-headline-done ((,class (:foreground ,white)))) + `(org-link ((,class (:foreground ,br-blue :underline t)))) + `(org-date ((,class (:foreground ,br-cyan)))) + `(org-code ((,class (:foreground ,br-green :background ,black)))) + `(org-block ((,class (:background ,black)))) + `(org-block-begin-line ((,class (:foreground ,br-black :background ,black)))) + `(org-block-end-line ((,class (:foreground ,br-black :background ,black)))) + + ;; Whitespace + `(whitespace-space ((,class (:foreground ,br-black)))) + `(whitespace-tab ((,class (:foreground ,br-black)))) + `(whitespace-newline ((,class (:foreground ,br-black)))) + `(whitespace-trailing ((,class (:background ,red)))) + + ;; Term colors (for ansi-term, vterm, etc.) + `(term-color-black ((,class (:foreground ,black :background ,black)))) + `(term-color-red ((,class (:foreground ,red :background ,red)))) + `(term-color-green ((,class (:foreground ,green :background ,green)))) + `(term-color-yellow ((,class (:foreground ,yellow :background ,yellow)))) + `(term-color-blue ((,class (:foreground ,blue :background ,blue)))) + `(term-color-magenta ((,class (:foreground ,magenta :background ,magenta)))) + `(term-color-cyan ((,class (:foreground ,cyan :background ,cyan)))) + `(term-color-white ((,class (:foreground ,white :background ,white)))))) + +;;;###autoload +(when load-file-name + (add-to-list 'custom-theme-load-path + (file-name-as-directory (file-name-directory load-file-name)))) + +(provide-theme 'bsd-dark) + +;;; bsd-dark-theme.el ends here blob - /dev/null blob + 6eb4fa0364f504e328aae45269f54037224ad7fa (mode 644) --- /dev/null +++ .emacs.d/early-init.el @@ -0,0 +1,43 @@ +;;; ________ _______ __ __ +;;; / | / \ / | / | +;;; $$$$$$$$/ _____ ____ ______ _______ _______ $$$$$$$ | ______ ____$$ | ______ ______ _______$$ | __ +;;; $$ |__ / \/ \ / \ / |/ | $$ |__$$ |/ \ / $$ |/ \ / \ / $$ | / | +;;; $$ | $$$$$$ $$$$ |$$$$$$ /$$$$$$$//$$$$$$$/ $$ $$= 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) + +;; 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 + 2ff7dd4ba2b23bd60ef92cfa60f12c2b03677a62 (mode 644) --- /dev/null +++ .emacs.d/extras/email.el @@ -0,0 +1,30 @@ +;;; 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 + ca56bf49265a080f65c2e9962180d6bc3fa99dd5 (mode 644) --- /dev/null +++ .emacs.d/extras/org-intro.txt @@ -0,0 +1,91 @@ +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 + 8f8db712d97722321d6a767e9a345f4d893d94e4 (mode 644) --- /dev/null +++ .emacs.d/extras/org.el @@ -0,0 +1,161 @@ +;;; 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 blob - /dev/null blob + 132215ca21cf355575f7146b723d72644095d008 (mode 644) --- /dev/null +++ .emacs.d/extras/researcher.el @@ -0,0 +1,99 @@ +;;; 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)) blob - /dev/null blob + d6a8db6dc1d4f745ebe81c51d3cf0c3962231715 (mode 644) --- /dev/null +++ .emacs.d/extras/vim-like.el @@ -0,0 +1,36 @@ +;;; 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 + 9f2be5f3205225cf8ae743f76924d76c58e78644 (mode 644) --- /dev/null +++ .emacs.d/extras/writer.el @@ -0,0 +1,71 @@ +;;; 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 + 90da61f21993d746333d12bf60b60c88dd13f896 (mode 644) --- /dev/null +++ .emacs.d/init.el @@ -0,0 +1,272 @@ +;;; 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- +(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) + +;; 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)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; 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-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) + +;; For terminal users, make the mouse more useful + +(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 + +;; 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 +;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(load-theme 'bsd-dark t) + +;; (use-package stimmung-themes +;; :ensure t) + +;; (use-package auto-dark +;; :ensure t +;; :custom +;; (auto-dark-dark-theme 'stimmung-themes-dark) +;; (auto-dark-light-theme 'stimmung-themes-light) +;; :config +;; (auto-dark-mode t)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; +;;; 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. + '(custom-safe-themes + '("d3fc453759c879c1dc857fe4afcfe6cc2336b299d3aeef2cb309d049b85a2396" + default)) + '(inhibit-startup-screen t) + '(package-selected-packages nil)) +(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. + '(help-key-binding ((t (:background "#000000" :foreground "#CC9528" :family "Comic Code"))))) + +(setq gc-cons-threshold (or bedrock--initial-gc-threshold 800000)) +