Skip to content
HenningzenPublic

About

Emacs configuration

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

44 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

.emacs.d - Personal Emacs Configuration

Introduction

My Emacs settings - updated for 2026

General characteristics:

  • Completion → completion-at-point (Cider/Sly) via Corfu - Cape
  • Vertico → Vertical completion interface
  • Consult → Smart buffer/file/line commands
  • Orderless → Space-separated fuzzy matching
  • Marginalia → Minibuffer annotations
  • Perspective → Per-project buffer isolation
  • Paredit → Structural editing
  • Sly → REPL, evaluation, navigation (Common Lisp)
  • Quicklisp → Common Lisp library manager
  • Corfu/Cape → In-buffer completion (completion-at-point UI)
  • Cider → REPL, evaluation, debugging (Clojure)
  • Basedpyright → Python types, navigation, rename (LSP)
  • Ruff → Python lint + format-on-save (LSP add-on + apheleia)
  • uv/envrc → Python projects with per-project venvs, auto-activated

Elaborate over CAPF-NATIVE stack.

Packages

dash

Proper list API for Emacs Lisp, Magnar Sveen)

clojure-lsp (not in use)

Installed with script in usr/local/bin, https://emacs-lsp.github.io/lsp-mode/tutorials/clojure-guide (Eric Dallo)

Official guide, but with tweaks:

What I kept:

  • Performance tuning (gc-cons-threshold, read-process-output-max)
  • Hooks for clojure-mode, clojurescript-mode, clojurec-mode
  • LSP as the intelligence layer

What I have changed or removed:

  • company-mode (for now)
  • LSP provides completion via completion-at-point
  • Works with our existing Vertico/Orderless stack
  • Simpler, fewer moving parts
  • Removed flycheck - LSP has built-in diagnostics.

Characteristics (observed so far):

  • lsp-mode shows errors/warnings automatically
  • No need for separate checker
  • Removed lsp-treemacs

Usage (so far):

  • Jump to definition - M-. (lsp-ui-peek)
  • Find references - M-?
  • Completion - Works with TAB/completion-at-point
  • Rename - C-c l r
  • Code actions - C-c l a
  • Hover documentation - Automatic in minibuffer
  • Diagnostics - Errors/warnings inline
  • Compliant with Cider
  • Paredit and structural editing untouched

gptel

Directive and instructions are set in ‘settings/setup-gptel.el’

commandDescription
M-x gptel-switch-profileDirective + backend + model together
M-x gptel-set-directivesDirective only
M-x gptel-switch-backendBackend/model only

corfu / cape

In-buffer completion UI, the companion to Vertico for completion-at-point. Corfu take care of rendering the popup, while Cape supplies extra backends (file paths, dabbrev, etc.).

Configured in ‘settings/setup-corfu.el’.

Why Corfu, not Company:

  • CAPF-native (completion-at-point-functions) same minimalist philosophy as Vertico and Orderless.
  • Works automatically with Cider and Sly - no config per backend
  • Less complexity from fewer moving parts, and lighter than company-mode

Behaviour:

  • Popups will appear automatically while typing (corfu-auto)
  • corfu-popupinfo shows docs for the selected candidate
KeyDescription
TABComplete / cycle candidates
C-nNext candidate
C-pPrevious candidate
RETAccept selected candidate
C-gAbort completion
M-dToggle documentation popup (corfu-popupinfo)
C-M-iManually trigger completion-at-point

clojure-lsp [DISABLED]

Disabled for now in favor of Cider 2.x. Configuration code retained for future reference.

Installed with script in usr/local/bin, https://emacs-lsp.github.io/lsp-mode/tutorials/clojure-guide (Eric Dallo)

What I kept:

  • Performance tuning (gc-cons-threshold, read-process-output-max)
  • Hooks for clojure-mode, clojurescript-mode, clojurec-mode
  • LSP as the intelligence layer

What I have changed or removed:

  • Removed company-mode, because…
  • LSP provides completion via completion-at-point
  • Works with the existing Vertico/Orderless stack
  • Less complexity while LSP is driving, it simpler, fewer moving parts involved.
  • Removed flycheck - LSP has built-in diagnostics.

Characteristics (observed so far):

  • lsp-mode shows errors/warnings automatically
  • No need for separate checker
  • (Removed lsp-treemacs)

Usage (what I learned so far):

  • Jump to definition - M-. (lsp-ui-peek)
  • Find references - M-?
  • Completion - Works with TAB/completion-at-point
  • Rename - C-c l r
  • Code actions - C-c l a
  • Hover documentation - Automatic in minibuffer
  • Diagnostics - Errors/warnings inline
  • Compliant with Cider
  • Paredit and structural editing untouched

gptel

Directive and instructions are set in ‘settings/setup-gptel.el’

commandDescription
M-x gptel-switch-profileDirective + backend + model together
M-x gptel-set-directivesDirective only
M-x gptel-switch-backendBackend/model only

sly

Common Lisp IDE. Configured in ‘settings/setup-sly.el’.

Setup notes:

  • SBCL installed system-wide via apt install sbcl (/usr/bin/sbcl)
  • inferior-lisp-program set to “sbcl”
  • Completion via completion-at-point - works with Corfu, no extra wiring
  • Contribs: sly-quicklisp, sly-asdf (loaded if present)

Quicklisp:

  • Installed per-user in ~/quicklisp/ (NOT system-wide / not under sudo)
  • Loaded at SBCL startup via ~/.sbclrc (written by ql:add-to-init-file)
  • Because Sly launches sbcl as your user, it reads your ~/.sbclrc and Quicklisp is available automatically in the REPL

NOTE to self:

  • Files in $HOME must be owned by your dev user, not root. A missing or root-owned ~/.sbclrc is the usual cause of the slynk-quicklisp MISSING-DEPENDENCY error at connect time.

org-present

TBA

visual-fill-column

TBA

Using Emacs

Completion

We got two complementary strategies for text completion:

Primary: Corfu (automatic popup)

Default completion UI that pops up while you type. Works with Cider, Sly, and file paths via Cape. This is the best choice for typical completion scenarios.

KeyDescription
TABComplete / cycle candidates
C-nNext candidate
C-pPrevious candidate
RETAccept selected candidate
C-gAbort completion
M-dToggle documentation popup (corfu-popupinfo)
C-M-iManually trigger completion-at-point

Supplementary: Hippie-expand (manual expansion)

Triggered manually with M-/. Cycles through various expansion strategies (dabbrev, file names, lines, symbols). Gives me an option for different expansion styles or if I need more control.

M-/Smart expansion with all strategies
C-M-/Expand full lines only (great for repeating similar code)
C-c /Case-sensitive expansion
C-c M-/Words/symbols only (no file paths or lines)
C-c C-/Current buffer only (faster, less noise)
C-c f /File name completion only

General

KeyDescription
C-kKill to end of form (structurally safe)
M-kKill whole form
C-M-kKill forward expression
C-x C-fOpen a file. Starts in the current directory
C-_Undo
C-M-_Redo
C-x uUndo tree - vundo tree-view

Paredit

Paredit operations are semantic:

KeyDescription
C-→slurp (expand form)
C-←barf (contract form)
M-ssplice (unwrap)
M-(wrap
C-M-f/bnavigate by form

Navigation:

KeyDescription
C-M-fForward by expression
C-M-bBackward by expression
C-M-uUp in tree
C-M-dDown in tree
C-→Slurp right (pull into form)
C-<right>Slurp right (pull into form)
C-←Barf right (push out of form)
C-<left>Barf right (push out of form)
C-M-←Slurp left
C-M-→Barf left

Wrapping:

KeyDescription
M-(Wrap with ()
M-sSplice (remove wrapping)
M-S (shift-s)Split expression
M-JJoin expressions

Consult

KeyDescription
C-x bconsult-buffer - Buffer switching with groups (files, buffers, bookmarks)
M-s lconsult-line - Jump to any line in current buffer
M-g gconsult-goto-line - Better goto-line with preview
M-g iconsult-imenu - Navigate code structure (great for Clojure!)

Sly (Common Lisp REPL)

Start with M-x sly (launches sbcl and connects to a sly-mrepl).

KeyDescription
M-x slyStart / connect REPL
C-c C-cCompile current top-level form
C-c C-kCompile & load whole file
C-x C-eEval form before point
C-c C-zSwitch to REPL
M-.Jump to definition
M-,Jump back
C-c C-d dDescribe symbol
C-c C-d hHyperSpec lookup

Sly REPL history

SLY history is bound to M-p/M-n by default; CIDER-style arrow bindings are added in setup-sly.el.

Note: history is persistent across sessions.

KeyDescription
M-pPrevious input
M-nNext input
M-rSearch history backwards (incremental)
M-sSearch history forwards
C-<up>Previous input (CIDER-style, custom)
=C-<down>=Next input (CIDER-style, custom)

Quicklisp from the REPL

Command / FormDescription
M-x sly-quickloadLoad a system interactively
(ql:quickload :alexandria)Load a library
(ql:system-apropos "json")Search available systems
(ql:update-all-dists)Update library distributions

Presenting

org-present

org-reveal

Mermaid diagraming

KeyDescription
C-c C-cCompile current buffer/region to image
C-c C-o
C-c C-dOpen mermaid.live docs

Python

Python on the uv toolchain. Configured in ‘settings/setup-python.el’.

  • uv → ONE binary replaces pyenv/pip/virtualenv/poetry
  • basedpyright → types, navigation, rename - the PyCharm-parity piece
  • ruff → lint - format - import sort (add-on LSP server)
  • envrc/direnv → per-project .venv, invisible after one-time setup
  • apheleia → ruff format - import sort on every save
  • dape → debugging via debugpy (modern dap-mode replacement)
  • python-pytest → magit-style transient test runner
  • org-babel → literate exploration; optional Jupyter kernels

Workflow:

  • basedpyright provides semantics (completion via Corfu, M-., rename),
  • ruff provides style and lint,
  • apheleia makes formatting.

Setup notes

  • basedpyright and ruff installed per-user via uv tool install into ~/.local/bin (added to exec-path in setup-python.el)
  • ruff runs as an add-on LSP server next to basedpyright; lint rules and formatting live per-project in pyproject.toml
  • envrc: each project needs .envrc with . .venv/bin/activate and a one-time direnv allow
  • setup-python.el is self-contained: it does not depend on setup-lsp.el (Clojure, currently disabled); overlapping settings are identical, so enabling both is harmless

Key-bindings

KeyDescription
M-.Jump to definition
M-,Jump back
M-?Find references
C-c l rRename (project-wide, type-aware)
C-c l aCode action (auto-import, ignore rule, ..)
C-c l dDescribe symbol at point
C-c l tFind type definition
TABComplete (Corfu, LSP-fed)
(save)ruff format + import sort, automatic
KeyDescription
C-c C-pStart inferior Python REPL
C-c C-cSend buffer to REPL
C-c C-rSend region
C-c C-eSend statement at point
C-c C-zSwitch to the REPL buffer
Key / CommandDescription
M-x dapeStart a debug session (pick debugpy)
C-x C-a bToggle breakpoint
C-x C-a nNext (step over)
C-x C-a sStep in
C-x C-a oStep out
C-x C-a cContinue
C-x C-a qQuit session
M-x dape-infoVariables/breakpoints/threads windows

About

Emacs configuration

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages