Subject: [PATCH] Add repeat-map for calendar year navigation commands

From: "Paul D. Nelson" <[email-masked]>
Date: Tue, 10 Jun 2025 20:17:13 +0200

With this patch and with repeat-mode active, one can navigate by year in
calendar using 'C-x ] ]' rather than 'C-x ] C-x ]', for instance.

>From f9bbd97738b639372279aebdd0f1347143ac45d0 Mon Sep 17 00:00:00 2001
From: Paul Nelson <[email-masked]>
Date: Tue, 10 Jun 2025 11:33:05 +0200
Subject: [PATCH] Add repeat-map for calendar year navigation commands

* lisp/calendar/calendar.el
(calendar-year-navigation-repeat-map): New keymap for repeating
calendar-forward-year and calendar-backward-year commands when
'repeat-mode' is active.
---
 etc/NEWS                  | 7 +++++++
 lisp/calendar/calendar.el | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index c5172b40da6..f7720290f5a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2168,6 +2168,13 @@ is bound to 'C-l' in the calendar buffer.
 You can now use the mouse wheel to scroll the calendar by 3 months.
 With the shift modifier, it scrolls by one month.  With the meta
 modifier, it scrolls by year.
+
+*** New 'repeat-map' for calendar year navigation commands.
+The commands 'calendar-forward-year' and 'calendar-backward-year' can
+now be repeated using 'repeat-mode'.  With 'repeat-mode' enabled, after
+invoking one of these commands via 'C-x [' or 'C-x ]', you can press '['
+or ']' to repeat the command.
+
 
 * New Modes and Packages in Emacs 31.1
 
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index c448955450e..6e69d76b201 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -1744,6 +1744,12 @@ calendar-mode-map
     map)
   "Keymap for `calendar-mode'.")
 
+(defvar-keymap calendar-year-navigation-repeat-map
+  :doc "Keymap to repeat calendar year navigation.  Used in `repeat-mode'."
+  :repeat t
+  "]" #'calendar-forward-year
+  "[" #'calendar-backward-year)
+
 ;; Calendar mode is suitable only for specially formatted data.
 (put 'calendar-mode 'mode-class 'special)
 
-- 
2.39.3 (Apple Git-145)