@@ -249,6 +249,7 @@ Out-of-the box clojure-mode understands lein, boot and gradle."
249
249
[" Fully unwind a threading macro" clojure-unwind-all])
250
250
" --"
251
251
[" View a Clojure guide" clojure-view-guide]
252
+ [" View a Clojure reference section" clojure-view-reference-section]
252
253
" --"
253
254
[" Report a clojure-mode bug" clojure-mode-report-bug]
254
255
[" Clojure-mode version" clojure-mode-display-version]))
@@ -314,6 +315,46 @@ The command will prompt you to select one of the available guides."
314
315
(let ((guide-url (concat clojure-guides-base-url (cdr (assoc guide clojure-guides)))))
315
316
(browse-url guide-url)))))
316
317
318
+ (defconst clojure-reference-base-url " https://clojure.org/reference/"
319
+ " The base URL for the official Clojure reference." )
320
+
321
+ (defconst clojure-reference-sections '((" The Reader" . " reader" )
322
+ (" The REPL and main" . " repl_and_main" )
323
+ (" Evaluation" . " evaluation" )
324
+ (" Special Forms" . " special_forms" )
325
+ (" Macros" . " macros" )
326
+ (" Other Functions" . " other_functions" )
327
+ (" Data Structures" . " data_structures" )
328
+ (" Datatypes" . " datatypes" )
329
+ (" Sequences" . " sequences" )
330
+ (" Transients" . " transients" )
331
+ (" Transducers" . " transducers" )
332
+ (" Multimethods and Hierarchies" . " multimethods" )
333
+ (" Protocols" . " protocols" )
334
+ (" Metadata" . " metadata" )
335
+ (" Namespaces" . " namespaces" )
336
+ (" Libs" . " libs" )
337
+ (" Vars and Environments" . " vars" )
338
+ (" Refs and Transactions" . " refs" )
339
+ (" Agents" . " agents" )
340
+ (" Atoms" . " atoms" )
341
+ (" Reducers" . " reducers" )
342
+ (" Java Interop" . " java_interop" )
343
+ (" Compilation and Class Generation" . " compilation" )
344
+ (" Other Libraries" . " other_libraries" )
345
+ (" Differences with Lisps" . " lisps" )))
346
+
347
+ (defun clojure-view-reference-section ()
348
+ " Open a Clojure reference section in your default browser.
349
+
350
+ The command will prompt you to select one of the available sections."
351
+ (interactive )
352
+ (let ((section (completing-read " Select a reference section: " (mapcar #'car clojure-reference-sections))))
353
+ (when section
354
+ (let ((section-url (concat clojure-reference-base-url (cdr (assoc section clojure-reference-sections)))))
355
+ (browse-url section-url)))))
356
+
357
+
317
358
(defun clojure-space-for-delimiter-p (endp delim )
318
359
" Prevent paredit from inserting useless spaces.
319
360
See `paredit-space-for-delimiter-predicates' for the meaning of
@@ -1033,9 +1074,9 @@ When called from lisp code align everything between BEG and END."
1033
1074
(dotimes (_ count)
1034
1075
(align-region (point ) sexp-end nil
1035
1076
'((clojure-align (regexp . clojure--search-whitespace-after-next-sexp)
1036
- (group . 1 )
1037
- (separate . " ^ *$" )
1038
- (repeat . t )))
1077
+ (group . 1 )
1078
+ (separate . " ^ *$" )
1079
+ (repeat . t )))
1039
1080
nil ))
1040
1081
; ; Reindent after aligning because of #360.
1041
1082
(indent-region (point ) sexp-end)))))
0 commit comments