deniz.in

Markets

Weather

Loading weather

· via Hacker News – Front Page (native)

Rune rewrites the Emacs core in Rust, aiming for multi-threaded Elisp

Rune, an experimental Emacs core written in Rust, targets multi-threaded Elisp, bug-compatibility with existing packages, and faster GC, regex and JSON via the Rust ecosystem.

Rune rewrites the Emacs core in Rust, aiming for multi-threaded Elisp

An experimental rewrite of the Emacs core in Rust, called Rune, reached Hacker News's front page on November 24, 2026. According to the project's README, the name stands for "Rust UNder Emacs" and the code is at a very early phase. It lists three goals: bring multi-threaded Emacs Lisp to the editor, remain "bug-compatible" with existing Elisp packages so that current code keeps working, and enable performance improvements — including faster garbage collection, regex and JSON — by drawing on the Rust ecosystem.

From runtime to a minimal editor

The stated next milestone is an editor MVP. A basic Elisp runtime already exists, and the focus is now on basic editing functionality inside a minimal GUI: buffers, text insertion and deletion, a cursor, line wrapping, scrolling, file I/O and display tables. Rune does not rewrite Emacs's Lisp library from scratch; it pulls Lisp files from the emacs-mirror copy of the Emacs 29.1 release tree, and any changes needed to get them loading carry a RUNE-BOOTSTRAP tag. Running cargo run --release -- --repl loads the bootstrapped Elisp and opens a REPL, while a --no-bootstrap flag starts one with only built-in functions available.

How the core is put together

The repository is organized as a main rune package built on crates in a crates directory, one of which, rune-macros, defines the defun proc macro used to declare built-in functions. The README's worked example takes the Lisp signature of substring, translates its types into Rust equivalents — falling back to a generic Object type when the correct one is unclear — and annotates the resulting Rust function with #[defun].

The modules break down as follows: objects holds the interpreter's basic values, modeled on Emacs objects with tagged pointers and inline fixnums; reader is a hand-rolled Elisp reader that turns a string into a cons cell without relying on parsing libraries; env contains the global obarray, where function bindings are global and immutable but value bindings are thread-local and mutable, a split intended to let future threads run functions without copying them; gc holds the allocator, the garbage collector and all object-rooting code; bytecode is a VM that reuses Emacs's own opcodes and compiles through the stock bytecomp.el; and interpreter is a plain Elisp interpreter used only to bootstrap the byte-compiler. The fns, data and alloc modules define built-ins, some of them stubs until real functionality is needed.

Progress, the README says, comes from attempting to load one more Elisp file and fixing whatever fails, which usually means implementing additional primitive functions.

Compatibility as a test suite

The most notable engineering decision is differential testing against real Emacs. Rune provides an assert_elprop! macro that evaluates the same Lisp form in both Rune and GNU Emacs and compares the results, and it plugs into the proptest crate. The documented examples range from confirming that (+ 40 2) yields 42 in both implementations to checking make-vector consistency for arbitrary byte-sized arguments. The Rust side gets scrutiny too: the test suite runs under MIRI with strict-provenance flags to surface undefined behavior, and the README explains how to run the Windows tests from Linux through Wine, with a setup script that also installs Emacs inside the Wine prefix.

A lineage of Rust Emacsen

Rune has predecessors. Remacs, cited by the README as a major inspiration, took a different route: it enabled interop between Emacs's C core and Rust so that pieces could be replaced piecemeal, but that project is now unmaintained. emacs-ng, described as Remacs's spiritual successor, embeds the Deno runtime so extensions can be written in Elisp or JavaScript. The Rune author has also published blog posts on building tagged pointers in Rust and on implementing a safe garbage collector, alongside essays on adding multi-threading to Emacs and on what Rust could uniquely bring to the editor.

Why it matters

Emacs Lisp is effectively single-threaded, which constrains any package that wants to do heavy computation, network work or search without freezing the editor. Rune's answer is not a new language but the same language on a new core, with compatibility treated as a testable property rather than a hope: every assert_elprop! check pins Rune's behavior to what GNU Emacs actually does, quirks included. The environment design — immutable global functions paired with thread-local mutable values — is also one of the more concrete public sketches of how multi-threaded Elisp could work in practice.

The caveat is sizeable: the project has not yet reached its minimal editor, so it is a research effort to watch rather than a usable replacement. Still, for one of the oldest living editor ecosystems, a path that modernizes the core in a memory-safe language without discarding decades of Elisp code is rare, and Rune is documenting that path in unusual detail through its design notes, blog posts and test harness.

  • #emacs
  • #rust
  • #elisp
  • #open-source
  • #editors

Related posts