Skip to content

Commit 603660f

Browse files
committed
Add documentation and bug reporting commands from clojure-mode
1 parent da56a69 commit 603660f

File tree

2 files changed

+111
-1
lines changed

2 files changed

+111
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
`for` and `doseq` forms.
99
- [#116](https://github.com/clojure-emacs/clojure-ts-mode/pull/116): Extend built-in completion to complete all imported symbols from an `ns`
1010
form.
11+
- Add documentation and bug reporting commands from `clojure-mode`.
1112

1213
## 0.5.1 (2025-06-17)
1314

clojure-ts-mode.el

Lines changed: 110 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2549,6 +2549,108 @@ before DELIM-OPEN."
25492549
map)
25502550
"Keymap for `clojure-ts-mode' refactoring commands.")
25512551

2552+
;;; Bug reporting
2553+
(defconst clojure-ts-mode-report-bug-url "https://github.com/clojure-emacs/clojure-ts-mode/issues/new"
2554+
"The URL to report a `clojure-ts-mode' issue.")
2555+
2556+
(defun clojure-ts-mode-report-bug ()
2557+
"Report a bug in your default browser."
2558+
(interactive)
2559+
(browse-url clojure-ts-mode-report-bug-url))
2560+
2561+
;; Clojure guides
2562+
(defconst clojure-ts-guides-base-url "https://clojure.org/guides/"
2563+
"The base URL for official Clojure guides.")
2564+
2565+
(defconst clojure-ts-guides '(("Getting Started" . "getting_started")
2566+
("Install Clojure" . "install_clojure")
2567+
("Editors" . "editors")
2568+
("Structural Editing" . "structural_editing")
2569+
("REPL Programming" . "repl/introduction")
2570+
("Learn Clojure" . "learn/clojure")
2571+
("FAQ" . "faq")
2572+
("spec" . "spec")
2573+
("Reading Clojure Characters" . "weird_characters")
2574+
("Destructuring" . "destructuring")
2575+
("Threading Macros" . "threading_macros")
2576+
("Equality" . "equality")
2577+
("Comparators" . "comparators")
2578+
("Reader Conditionals" . "reader_conditionals")
2579+
("Higher Order Functions" . "higher_order_functions")
2580+
("Dev Startup Time" . "dev_startup_time")
2581+
("Deps and CLI" . "deps_and_cli")
2582+
("tools.build" . "tools_build")
2583+
("core.async Walkthrough" . "async_walkthrough")
2584+
("Go Block Best Practices" . "core_async_go")
2585+
("test.check" . "test_check_beginner"))
2586+
"A list of all official Clojure guides.")
2587+
2588+
(defun clojure-ts-view-guide ()
2589+
"Open a Clojure guide in your default browser.
2590+
2591+
The command will prompt you to select one of the available guides."
2592+
(interactive)
2593+
(let ((guide (completing-read "Select a guide: " (mapcar #'car clojure-ts-guides))))
2594+
(when guide
2595+
(let ((guide-url (concat clojure-ts-guides-base-url (cdr (assoc guide clojure-ts-guides)))))
2596+
(browse-url guide-url)))))
2597+
2598+
(defconst clojure-ts-reference-base-url "https://clojure.org/reference/"
2599+
"The base URL for the official Clojure reference.")
2600+
2601+
(defconst clojure-ts-reference-sections '(("The Reader" . "reader")
2602+
("The REPL and main" . "repl_and_main")
2603+
("Evaluation" . "evaluation")
2604+
("Special Forms" . "special_forms")
2605+
("Macros" . "macros")
2606+
("Other Functions" . "other_functions")
2607+
("Data Structures" . "data_structures")
2608+
("Datatypes" . "datatypes")
2609+
("Sequences" . "sequences")
2610+
("Transients" . "transients")
2611+
("Transducers" . "transducers")
2612+
("Multimethods and Hierarchies" . "multimethods")
2613+
("Protocols" . "protocols")
2614+
("Metadata" . "metadata")
2615+
("Namespaces" . "namespaces")
2616+
("Libs" . "libs")
2617+
("Vars and Environments" . "vars")
2618+
("Refs and Transactions" . "refs")
2619+
("Agents" . "agents")
2620+
("Atoms" . "atoms")
2621+
("Reducers" . "reducers")
2622+
("Java Interop" . "java_interop")
2623+
("Compilation and Class Generation" . "compilation")
2624+
("Other Libraries" . "other_libraries")
2625+
("Differences with Lisps" . "lisps")
2626+
("Deps and CLI" . "deps_and_cli")))
2627+
2628+
(defun clojure-ts-view-reference-section ()
2629+
"Open a Clojure reference section in your default browser.
2630+
2631+
The command will prompt you to select one of the available sections."
2632+
(interactive)
2633+
(let ((section (completing-read "Select a reference section: " (mapcar #'car clojure-ts-reference-sections))))
2634+
(when section
2635+
(let ((section-url (concat clojure-ts-reference-base-url (cdr (assoc section clojure-ts-reference-sections)))))
2636+
(browse-url section-url)))))
2637+
2638+
(defconst clojure-ts-cheatsheet-url "https://clojure.org/api/cheatsheet"
2639+
"The URL of the official Clojure cheatsheet.")
2640+
2641+
(defun clojure-ts-view-cheatsheet ()
2642+
"Open the Clojure cheatsheet in your default browser."
2643+
(interactive)
2644+
(browse-url clojure-ts-cheatsheet-url))
2645+
2646+
(defconst clojure-ts-style-guide-url "https://guide.clojure.style"
2647+
"The URL of the Clojure style guide.")
2648+
2649+
(defun clojure-ts-view-style-guide ()
2650+
"Open the Clojure style guide in your default browser."
2651+
(interactive)
2652+
(browse-url clojure-ts-style-guide-url))
2653+
25522654
(defvar clojure-ts-mode-map
25532655
(let ((map (make-sparse-keymap)))
25542656
;;(set-keymap-parent map clojure-mode-map)
@@ -2576,7 +2678,14 @@ before DELIM-OPEN."
25762678
"--"
25772679
["Unwind once" clojure-ts-unwind]
25782680
["Fully unwind a threading macro" clojure-ts-unwind-all])
2579-
["Version" clojure-mode-display-version]))
2681+
("Documentation"
2682+
["View a Clojure guide" clojure-ts-view-guide]
2683+
["View a Clojure reference section" clojure-ts-view-reference-section]
2684+
["View the Clojure cheatsheet" clojure-ts-view-cheatsheet]
2685+
["View the Clojure style guide" clojure-ts-view-style-guide])
2686+
"--"
2687+
["Report a clojure-mode bug" clojure-ts-mode-report-bug]
2688+
["Version" clojure-ts-mode-display-version]))
25802689
map)
25812690
"Keymap for `clojure-ts-mode'.")
25822691

0 commit comments

Comments
 (0)