r/Clojure • u/TTalkIM • 17h ago
Coxswain · An Emacs-style code editor, rebuilt in Clojure · TTalk
https://www.ttalk.im/en/products/coxn/
Coxswain (command name: coxn) is an Emacs-style text editor redeveloped from scratch in Clojure, running on the JVM with a terminal TUI as its default form, while offering an optional GUI version based on Compose Multiplatform (coxn gui). The project's design philosophy is "core editor + layered feature mounting": keybindings and command names strictly follow the Emacs global-map, and on top of that it adds its own M-m leader-key system, allowing Emacs users to migrate at virtually zero cost.
The editor core provides basic editing, buffer management, and window management. It also integrates tree-sitter to deliver syntax highlighting and structured editing, covering languages such as Clojure, Common Lisp, C++, Java, Erlang, and Elixir. A general-purpose LSP client supports servers including clojure-lsp, clangd, jdtls, erlang_ls, elixir-ls, and cl-lsp — whichever is installed gets used, automatically launched when a file is opened and reused per project root. Additional features include floating completion popups and function signatures, in-project grep, a project tree, Git integration, CIDER/SLIME-style REPL connections (nREPL/SWANK), 14 color themes, major-mode hooks and a minor-mode mechanism, plus internationalization support.
Architecturally, the editing core and the frontends are strictly decoupled: the TUI and GUI are merely two frontend implementations of the same core, with the GUI-side Kotlin code connecting only through clojure.java.api without intruding into editing logic. The GUI edition targets everyday desktop use: system font fallback with CJK double-width alignment, fcitx/ibus input method support, HiDPI adaptation, drag-and-drop file opening, system clipboard integration, and software rendering fallback when no GL environment is available. All configuration lives in ~/.config/coxn/init.clj, and every behavior is customizable.
Performance and quality are equally central to the project: keypress handling takes priority over background tasks; REPL/LSP output is batched with bounded caching; paren matching, highlighting, and indentation are all optimized based on syntax trees and caches; frame rendering and region indentation achieve sub-millisecond to sub-hundred-millisecond performance; and hundreds of automated tests guard behavioral stability. The project explicitly builds no agent features and depends on no network services — it remains a pure, local, auditable editor.
In an era saturated with agent-generated code, a text editor may seem like a relic of the past — but it's never too late to build a tool that truly feels right in your hand, even if it belongs to a bygone age