@@ -20,6 +20,63 @@ completion, Port follows monroe's lead and implements such commands by simply
2020evaluating a Clojure form (e.g. ` (clojure.repl/doc foo) ` ) and printing the
2121result into the REPL buffer.
2222
23+ ## How does it compare to other Clojure tools for Emacs?
24+
25+ The Clojure-on-Emacs landscape can be thought of as a ladder where each rung
26+ adds structure to how the editor talks to a running Clojure. Roughly:
27+
28+ | Tool | Protocol | Server-side deps |
29+ | ------------------| ---------------------------------------| -------------------------------|
30+ | [ inf-clojure] [ ] | comint over stdio (or a socket REPL) | none |
31+ | ** Port** | prepl (TCP) | none — built into Clojure |
32+ | [ monroe] [ ] | nREPL | nREPL |
33+ | [ CIDER] [ ] | nREPL + cider-nrepl middleware | nREPL + cider-nrepl |
34+
35+ ** inf-clojure** sits closest to the metal: it runs a Clojure (or babashka,
36+ Planck, …) subprocess under Emacs's [ ` comint ` ] [ comint ] and parses its
37+ plain-text output. Helper commands like documentation and arglist lookup are
38+ implemented by sending predefined code snippets to the REPL and reading what
39+ the REPL prints back. Universal and cheap — but the lack of structured output
40+ means the editor can't always tell apart a return value, stdout, and an error.
41+
42+ ** Port** is one rung up. prepl is a tiny TCP protocol that ships with Clojure
43+ itself; instead of plain text it emits tagged EDN messages (` :ret ` , ` :out ` ,
44+ ` :err ` , ` :tap ` , ` :exception ` ). That structure is enough to build reliable
45+ tooling on top, once you add a small bootstrap form for request/response
46+ correlation (see [ ` doc/design.md ` ] ( doc/design.md ) ). Helper commands are still
47+ implemented by sending Clojure forms — same idea as inf-clojure — but Port
48+ can tell which response goes with which request without scraping prose.
49+
50+ ** monroe** is another rung up. It uses [ nREPL] [ ] , whose protocol provides
51+ sessions, ops, and request ids out of the box. The editor side stays small
52+ because nREPL gives it those primitives for free. No middleware required
53+ beyond plain nREPL.
54+
55+ ** CIDER** is the maximalist rung: nREPL plus the [ cider-nrepl] [ ] middleware
56+ suite plus a substantial editor codebase. The middleware provides
57+ server-side support for features that aren't cheap to build on bare nREPL —
58+ debugger, inspector, test runner, profiler, structured stacktrace browser,
59+ refactoring. Heavier setup, vastly more features.
60+
61+ A useful way to read the ladder: ** the bulk of each project lives wherever its
62+ protocol has the gaps** . inf-clojure is small because ` comint ` already
63+ exists. monroe is small because nREPL already gives it primitives. Port has
64+ to be slightly bigger than monroe — the two-socket model, the bootstrap —
65+ because prepl gives it less. CIDER's bulk mostly isn't even Emacs Lisp; it's
66+ ` cider-nrepl ` , server-side, because that's where nREPL is meant to be
67+ extended.
68+
69+ Pick the rung you actually want: maximum power → CIDER; small structured
70+ client over prepl → Port; small client over nREPL → monroe; zero server-side
71+ requirements → inf-clojure.
72+
73+ [ inf-clojure ] : https://github.com/clojure-emacs/inf-clojure
74+ [ monroe ] : https://github.com/sanel/monroe
75+ [ CIDER ] : https://github.com/clojure-emacs/cider
76+ [ nREPL ] : https://nrepl.org
77+ [ cider-nrepl ] : https://github.com/clojure-emacs/cider-nrepl
78+ [ comint ] : https://www.masteringemacs.org/article/comint-writing-command-interpreter
79+
2380## Architecture
2481
2582prepl has no built-in request id, so any tooling that needs to know which
0 commit comments