make the functions support repeat maps
2 files changed, 23 insertions(+), 1 deletions(-)

M caser.el
M +14 -0
@@ 12,6 12,20 @@ We recommend binding these functions to 
 (bind-key "M-D" #'dashcase-dwim)
+## Repeat case changes ##
+Sometimes, it's easier to call a `dwim` function multiple times in a row, rather than select a region first. To make this easier, this mode supports [repeat-mode]( Repeat-mode is a way of easily repeating related commands.
+To enable it, run this line:
+(repeat-mode 1)
+Then, each function is able to be repeated by pressing a single letter. Once you run caser/snakecase-dwim, it can be ran gain with `s`. Similarly, caser/camelcase-dwim can be repeated with `c`; caser/dashcase-dwim can be repeated with `d`.
+These keys can be customized; see variables `caser/snakecase-repeat-map`, `caser/camelcase-repeat-map`, and `caser/dashcase-repeat-map`.
 ## Non-ASCII Support ##
 Because this package uses standard Emacs [regexp character classes]( and [case conversion functions](, it fully supports changing the case of languages that don't use only ASCII letters. Try `orð á íslensku` (Icelandic), or `Deutsch ist ähnlich` (German).

M caser.el +9 -1
@@ 3,7 3,7 @@ 
 ;; Version: 0.1
 ;; Homepage:
-;; Package-Requires: ((emacs "24.1"))
+;; Package-Requires: ((emacs "29.1"))
 ;; Copyright 2023 Zachary Kanfer <>

@@ 30,6 30,8 @@ 
 ;;; Code:
+(require 'keymap)
 (defun caser-camelcase-dwim (arg)
   "Camelcase words in the region, if active; if not, camelcase word at point.

@@ 43,6 45,8 @@ to camelcase ARG words."
       (caser/camelcase-region (region-beginning) (region-end))
     (caser/camelcase-word arg)))
 (defalias 'caser/camelcase-dwim #'caser-camelcase-dwim)
+(defvar caser/camelcase-repeat-map (define-keymap "c" #'caser/camelcase-dwim))
+(put #'caser/camelcase-dwim 'repeat-map 'caser/camelcase-repeat-map)
 (defun caser-camelcase-region (region-beginning region-end)
   "Camelcase the region between REGION-BEGINNING and REGION-END.

@@ 202,6 206,8 @@ to snakecase ARG words."
       (caser/snakecase-region (region-beginning) (region-end))
     (caser/snakecase-word arg)))
 (defalias 'caser/snakecase-dwim #'caser-snakecase-dwim)
+(defvar caser/snakecase-repeat-map (define-keymap "s" #'caser/snakecase-dwim))
+(put #'caser/snakecase-dwim 'repeat-map 'caser/snakecase-repeat-map)
 (defun caser-snakecase-region (region-beginning region-end)
   "Snakecase the region between REGION-BEGINNING and REGION-END.

@@ 250,6 256,8 @@ to dashcase ARG words."
       (caser/dashcase-region (region-beginning) (region-end))
     (caser/dashcase-word arg)))
 (defalias 'caser/dashcase-dwim #'caser-dashcase-dwim)
+(defvar caser/dashcase-repeat-map (define-keymap "d" #'caser/dashcase-dwim))
+(put #'caser/dashcase-dwim 'repeat-map 'caser/dashcase-repeat-map)
 ;; (bind-key "M-C" #'caser/camelcase-dwim)