branch: externals/cm-mode
commit bf9fef45d41695e06d6c065a01d7f3b0974a5745
Author: Joost Kremers <[email protected]>
Commit: Joost Kremers <[email protected]>

    Make cm-(forward|backward)-change repeatable using repeat-mode.
---
 README.md  | 4 +++-
 cm-mode.el | 9 +++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 0be46ae2b7..a0e1f5a9e1 100644
--- a/README.md
+++ b/README.md
@@ -46,7 +46,9 @@ Note that the modeline shows the buffer's author tag: if 
`cm-author` is set, the
 
 ## Navigating changes ##
 
-You can jump to the previous/next change with the commands `C-c * b` and `C-c 
* f`, respectively. If point is inside a change, you can jump out of it with 
`C-c * *`.
+If point is inside a change, you can jump out of it with `C-c * *`. Point will 
be placed after the closing delimiter. If you are in a change that has a 
comment, point will be placed after the comment.
+
+You can jump to the previous/next change with the commands `C-c * b` and `C-c 
* f`, respectively. These work from anywhere in the buffer, not just when point 
is inside a change. If `repeat-mode` is enabled, these commands are repeatable 
with `f` and `b`, respectively.
 
 
 ## Accepting or rejecting changes ##
diff --git a/cm-mode.el b/cm-mode.el
index fc5bcd3557..dce6f65c4f 100644
--- a/cm-mode.el
+++ b/cm-mode.el
@@ -231,6 +231,15 @@ This keymap contains only one binding: `C-c *', which is 
bound to
 (define-key cm-prefix-map "t" #'cm-set-author)
 (define-key cm-prefix-map "F" #'cm-follow-changes)
 
+(defvar cm-mode-repeat-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "f") #'cm-forward-change)
+    (define-key map (kbd "b") #'cm-backward-change)
+    map)
+  "Repeat keymap for `cm-mode'.")
+(put 'cm-forward-change 'repeat-map 'cm-mode-repeat-map)
+(put 'cm-backward-change 'repeat-map 'cm-mode-repeat-map)
+
 (easy-menu-define cm-mode-menu cm-mode-map "CriticMarkup Menu."
   '("CriticMarkup"
     ["Addition" cm-addition t]

Reply via email to