summaryrefslogtreecommitdiff
path: root/modules/custom-text-enclose.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-10-25 19:56:40 -0500
committerCraig Jennings <c@cjennings.net>2025-10-25 19:56:40 -0500
commit746cefd4d674bfc6dd9fdfe4aeb79c7e760ec268 (patch)
tree8bb53c9300298028390dec51f8cc46ada5689b2e /modules/custom-text-enclose.el
parentd69f41af1f6e0d1bea8a2942f5e99b6ef961c1ef (diff)
refactor:keymaps: Replace define-prefix-command with defvar-keymap
Refactor the keymap definitions across multiple modules by replacing `define-prefix-command` with `defvar-keymap`. This simplifies the keymap setup and integrates better with the `which-key` package for enhanced documentation and usability. Updated modules include custom-ordering, custom-text-enclose, custom-whitespace, mail-config, music-config, org-drill-config, test-runner, and vc-config.
Diffstat (limited to 'modules/custom-text-enclose.el')
-rw-r--r--modules/custom-text-enclose.el15
1 files changed, 9 insertions, 6 deletions
diff --git a/modules/custom-text-enclose.el b/modules/custom-text-enclose.el
index fa41d39f..514419cd 100644
--- a/modules/custom-text-enclose.el
+++ b/modules/custom-text-enclose.el
@@ -69,12 +69,15 @@
(forward-line 1)))))
;; Surround, append, prepend prefix keymap
-(define-prefix-command 'cj/enclose-map nil
- "Keymap for enclosing text: surrounding, appending, and prepending.")
-(keymap-set cj/custom-keymap "s" #'cj/enclose-map)
-(keymap-set cj/enclose-map "s" #'cj/surround-word-or-region)
-(keymap-set cj/enclose-map "a" #'cj/append-to-lines-in-region-or-buffer)
-(keymap-set cj/enclose-map "p" #'cj/prepend-to-lines-in-region-or-buffer)
+(defvar-keymap cj/enclose-map
+ :doc "Keymap for enclosing text: surrounding, appending, and prepending"
+ "s" #'cj/surround-word-or-region
+ "a" #'cj/append-to-lines-in-region-or-buffer
+ "p" #'cj/prepend-to-lines-in-region-or-buffer)
+
+(keymap-set cj/custom-keymap "s" cj/enclose-map)
+(with-eval-after-load 'which-key
+ (which-key-add-key-based-replacements "C-; s" "text enclose menu"))
(provide 'custom-text-enclose)
;;; custom-text-enclose.el ends here.