Subject: bug#77417: [PATCH] Add repeat-map for Python indentation commands

From: "Paul D. Nelson" <[email-masked]>
Date: Mon, 31 Mar 2025 22:45:00 +0200

With this patch and with repeat-mode active, one can repeatedly indent
using 'C-c > >' rather than 'C-c > C-c >', for instance.

>From 9d2ab6651df1a068ad2e43d0f8b5e0df86210f25 Mon Sep 17 00:00:00 2001
From: Paul Nelson <[email-masked]>
Date: Mon, 31 Mar 2025 12:12:01 +0200
Subject: [PATCH] Add repeat-map for Python indentation commands

* lisp/progmodes/python.el (python-indent-repeat-map): New
keymap for repeating Python indentation commands when using
'repeat-mode'.
---
 etc/NEWS                 | 6 ++++++
 lisp/progmodes/python.el | 7 +++++++
 2 files changed, 13 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index 1bd2fd6d486..439bf400b4a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1334,6 +1334,12 @@ mode.  Now, one needs to say '(midnight-mode +1)' instead.
 
 ** Python mode
 
+*** New repeat-map for Python indentation commands.
+The commands 'python-indent-shift-left' and 'python-indent-shift-right'
+can now be repeated using 'repeat-mode'.  With 'repeat-mode' enabled,
+after invoking one of these commands via 'C-c <' or 'C-c >', you can
+press '<' or '>' to repeat the command.
+
 ---
 *** Prefer "python" for 'python-interpreter' and 'python-shell-interpreter'.
 On recent versions of mainstream GNU/Linux distributions, "python"
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index b6db6097d9f..ca62beb5929 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -373,6 +373,13 @@ python-base-mode-map
   ;; Utilities
   "<remap> <complete-symbol>" #'completion-at-point)
 
+(defvar-keymap python-indent-repeat-map
+  :doc "Keymap to repeat Python indentation commands.
+Used in `repeat-mode'."
+  :repeat t
+  "<" #'python-indent-shift-left
+  ">" #'python-indent-shift-right)
+
 (defvar subword-mode nil)
 
 (easy-menu-define python-menu python-base-mode-map
-- 
2.39.3 (Apple Git-145)