Difftron is a code diff tool that matches semantic entities (structs, functions, etc.) before doing a line-based diff. See this newsletter for motivation and a survey of prior art.
While there is a CLI for listing entities and diffing snapshots, the primary user interface an Emacs Magit-style interface:
Check out the demo video for more details.
I use Difftron regularly to review Rust and Clojure code.
I've vibe-coded everything with Codex/GPT 5.5. While I'm open to suggestions about architectural or code improvements, my primary interests are:
- exploring the overall problem/design space
- using the tool to support my other work
Checkout this repository somewhere on your computer, then run:
(load "wherever-you-checked-out-difftron-repo/emacs/difftron.el")
(setq difftron-executable "wherever-you-checked-out-difftron-repo/scripts/difftron_dev")
(difftron-bindings-mode)
You will need a Rust toolchain on your PATH.
Then you can run M-x difftron-diff to diff two snapshots.
I tend to use Difftron from within Magit's diff popup (press d for Magit's popup, then D for Difftron).
Doing this from a Magit diff will jump to the corresponding entity in Difftron.
When I'm working on difftron itself, I use a little reload function so I can unload/reload the elisp:
(defun difftron-reload ()
(interactive)
(let ((base-path "/Users/dev/work/difftron"))
(when (featurep 'difftron)
(unload-feature 'difftron t))
(load (concat base-path "/emacs/difftron.el"))
(setq difftron-executable (concat base-path "/scripts/difftron_dev"))))
(difftron-reload)
Difftron diffs "snapshots", which can be refs in a git repository, folders, or individual files.
Currently supports the languages I use: Rust, Clojure, and TypeScript.
Please format and test every commit:
./scripts/format.sh
./scripts/test.sh
- Instead of jumping to file from diff, jump to full git worktree (so LSP, etc. works)