22title : Clojure
33---
44
5- Lem's ` clojure-mode ` provides ** syntax highlighting** , ** LSP** support and ** nREPL** integration:
5+ Lem's ` clojure-mode ` provides ** syntax highlighting** , ** LSP** support and ** nREPL** integration, CIDER-compatible keybindings :
66
77- full-featured Clojure language mode with syntax highlighting, indentation, and LSP integration
88- nREPL client for interactive development with eval, macroexpand, and documentation commands
99- REPL mode with history, namespace tracking, and connection management
1010- Clojure-specific ** tools** : inspector, test runner, stacktrace navigation, and detective integration
1111
12- - Add comprehensive test suite covering bencode protocol, indentation, and mode functionality
12+ With a comprehensive test suite covering the bencode protocol, indentation, and mode functionality.
1313
1414## Features
1515
@@ -18,13 +18,16 @@ Lem's `clojure-mode` provides **syntax highlighting**, **LSP** support and **nRE
1818- syntax highlighting for Clojure/ClojureScript/EDN files
1919- Clojure-specific indentation with customizable rules
2020- rainbow parentheses support
21- - namespace detection and tracking
21+ - namespace detection and tracking, display namespace in modeline
2222- file type support: ` .clj ` , ` .cljs ` , ` .cljc ` , ` .cljx ` , ` .edn `
2323
2424### nREPL Integration (` nrepl-client.lisp ` , ` repl.lisp ` )
2525
2626- full nREPL protocol implementation using bencode
2727- interactive REPL with command history
28+ - connection management (` nrepl-connect ` , ` nrepl-disconnect ` )
29+ - session handling (` nrepl-clone-session ` , ` nrepl-close-session ` )
30+ - async/sync message sending
2831- eval commands: ` clojure-eval-last-sexp ` , ` clojure-eval-defun ` , ` clojure-eval-region ` , ` clojure-eval-buffer `
2932- macroexpand support: ` clojure-macroexpand-1 ` , ` clojure-macroexpand-all `
3033- documentation lookup: ` clojure-describe-symbol `
@@ -42,6 +45,124 @@ Lem's `clojure-mode` provides **syntax highlighting**, **LSP** support and **nRE
4245- integration with clojure-lsp for advanced IDE features
4346- root patterns: ` deps.edn ` , ` project.clj ` , ` build.boot ` , ` shadow-cljs.edn `
4447
48+ ## Commands
49+
50+
51+ ### Evaluation Commands
52+
53+ - ` clojure-eval-defun ` - Evaluate top-level form
54+ - ` clojure-eval-last-sexp ` - Evaluate expression before point
55+ - ` clojure-eval-region ` - Evaluate selected region
56+ - ` clojure-eval-buffer ` - Evaluate entire buffer
57+ - ` clojure-load-file ` - Load current file
58+ - ` clojure-switch-to-repl ` - Switch to REPL buffer
59+ - ` clojure-set-namespace ` - Change namespace
60+ - ` toggle-clojure-paren-coloring ` - Toggle rainbow parentheses
61+
62+ ### Keybindings (CIDER-compatible)
63+
64+ ```
65+ C-c C-c clojure-eval-defun
66+ C-x C-e clojure-eval-last-sexp
67+ C-c C-e clojure-eval-last-sexp
68+ C-c C-r clojure-eval-region
69+ C-c C-k clojure-load-file
70+ C-c C-l clojure-load-file
71+ C-c C-z clojure-switch-to-repl
72+ C-c M-n clojure-set-namespace-from-buffer
73+ ```
74+
75+ ### Macro Expansion
76+
77+ - ` clojure-macroexpand-1 ` (C-c Return) - Single-step expansion
78+ - ` clojure-macroexpand-all ` (C-c M-m) - Full expansion
79+ - Popup buffer with syntax highlighting
80+
81+ ### Documentation
82+
83+ - ` clojure-describe-symbol ` - Show docstring
84+ - ` clojure-describe-symbol-at-point ` (C-c C-d d) - Doc at point
85+ - Popup buffer for documentation display
86+
87+ ### Inspector
88+
89+ - ` clojure-inspector-mode ` with navigation
90+ - ` clojure-inspect ` - Inspect arbitrary expression
91+ - ` clojure-inspect-last-sexp ` (C-c I) - Inspect sexp
92+ - History navigation (l/Backspace to go back)
93+ - Refresh capability (g)
94+
95+ ### Test Runner
96+
97+ - ` clojure-run-test-at-point ` (C-c C-t t) - Run test under cursor
98+ - ` clojure-run-tests ` (C-c C-t n) - Run tests in namespace
99+ - ` clojure-run-all-tests ` (C-c C-t a) - Run all tests
100+ - ` clojure-rerun-last-test ` (C-c C-t l) - Rerun last test
101+ - Color-coded pass/fail/error display
102+ - Navigation between failures (n/p)
103+
104+ ### Stacktrace Navigation
105+
106+ - ` clojure-stacktrace-mode ` with keybindings
107+ - ` clojure-show-last-exception ` (C-c C-x)
108+ - Clickable stack frames to jump to source
109+ - Toggle Java frames visibility (j)
110+ - Frame navigation (n/p/Tab)
111+
112+ ### Detective Integration (Lem's interactive menu)
113+
114+ - Regex patterns for all definition types:
115+ - Functions: ` defn ` , ` defn- ` , ` defmulti ` , ` defmethod `
116+ - Macros: ` defmacro `
117+ - Types: ` defprotocol ` , ` defrecord ` , ` deftype ` , ` definterface `
118+ - Variables: ` def ` , ` defonce `
119+ - Namespaces: ` ns `
120+ - Tests: ` deftest ` , ` defspec `
121+ - Auto-setup via mode hook
122+
123+ ### Context Menu
124+
125+ - Context menu with evaluation actions
126+ - Items: Evaluate Expression, Evaluate Defun, Inspect Value, Run Test, Show Documentation
127+ - Auto-setup via mode hook
128+
129+ ### ClojureScript Support (Partial)
130+
131+ - File type registration for ` .cljs ` , ` .cljc ` , ` .cljx ` , ` .edn `
132+ - [ ] Shadow-cljs integration (future enhancement)
133+ - [ ] Figwheel support (future enhancement)
134+
135+ ### Refactoring Tools
136+
137+ - ` clojure-align-let ` (C-c C-a l) - Align let bindings
138+ - ` clojure-align-map ` (C-c C-a m) - Align map literals
139+ - ` clojure-cycle-privacy ` (C-c C-p) - Toggle defn/defn-
140+ - ` clojure-add-require ` (C-c C-a r) - Add require clause
141+ - ` clojure-toggle-keyword-string ` (C-c C-') - Toggle : keyword /"string"
142+ - ` clojure-thread-first ` - Convert to -> form
143+
144+
145+ ### LSP Integration
146+
147+ - clojure-lsp configuration
148+ - Project detection via ` deps.edn ` , ` project.clj ` , ` build.boot ` , ` shadow-cljs.edn `
149+ - Installation instructions
150+
151+ ### Syntax Highlighting
152+
153+ - TextMate-style language definition
154+ - Special forms (40+)
155+ - Built-in functions (100+)
156+ - Keywords, strings, regex literals
157+ - Numeric literals (decimal, hex, ratios)
158+ - Character literals
159+ - Metadata and deref
160+
161+ ### Navigation
162+
163+ - ` clojure-beginning-of-defun ` / ` clojure-end-of-defun `
164+ - ` clojure-indent-sexp ` (C-M-q)
165+
45166The original [ PR] ( https://github.com/lem-project/lem/pull/2068 ) comes with a full test suite.
46167
47168It was done with the help of Claude Code.
0 commit comments