Subject: Re: bug#59144: [PATCH] Add repeat-map for comint and eshell

From: Brian Leung <[email-masked]>
Date: Wed, 09 Nov 2022 07:27:40 +0000

Revised the commits. I reworded some commit messages and fixed a 
docstring typo.

>From 55663ae863d04e9e2d94bdc51b01fb1a4e2cc982 Mon Sep 17 00:00:00 2001
From: Brian Leung <[email-masked]>
Date: Tue, 8 Nov 2022 22:03:29 -0800
Subject: [PATCH 1/4] comint: Add repeat-map for comint-{next,previous}-prompt

* lisp/comint.el (comint-repeat-map): New keymap.
---
 lisp/comint.el | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lisp/comint.el b/lisp/comint.el
index 07ced8d321..93b97cb22b 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -604,6 +604,14 @@ comint-mode-map
 				       menu-bar-final-items))
     map))
 
+(defvar-keymap comint-repeat-map
+  :doc "Keymap to repeat comint key sequences.  Used in `repeat-mode'."
+  "C-n" #'comint-next-prompt
+  "C-p" #'comint-previous-prompt)
+
+(put #'comint-next-prompt 'repeat-map 'comint-repeat-map)
+(put #'comint-previous-prompt 'repeat-map 'comint-repeat-map)
+
 ;; Fixme: Is this still relevant?
 (defvar comint-ptyp t
   "Non-nil if communications via pty; false if by pipe.  Buffer local.
-- 
2.38.1

>From bda7857dfae7b92137b9bb67706599940f65a6c2 Mon Sep 17 00:00:00 2001
From: Brian Leung <[email-masked]>
Date: Tue, 8 Nov 2022 22:11:15 -0800
Subject: [PATCH 2/4] em-prompt: Add repeat-map for
 eshell-{next,previous}-prompt

* lisp/eshell/em-prompt.el (eshell-prompt-repeat-map): New keymap.
---
 lisp/eshell/em-prompt.el | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el
index a1a91e7d63..a8744de1db 100644
--- a/lisp/eshell/em-prompt.el
+++ b/lisp/eshell/em-prompt.el
@@ -100,6 +100,14 @@ eshell-prompt-mode-map
   "C-c C-n" #'eshell-next-prompt
   "C-c C-p" #'eshell-previous-prompt)
 
+(defvar-keymap eshell-prompt-repeat-map
+  :doc "Keymap to repeat eshell-prompt key sequences.  Used in `repeat-mode'."
+  "C-n" #'eshell-next-prompt
+  "C-p" #'eshell-previous-prompt)
+
+(put #'eshell-next-prompt 'repeat-map 'eshell-prompt-repeat-map)
+(put #'eshell-previous-prompt 'repeat-map 'eshell-prompt-repeat-map)
+
 ;;; Functions:
 
 (define-minor-mode eshell-prompt-mode
-- 
2.38.1

>From 565fc60e55813caefe431f34f08befd47f15a073 Mon Sep 17 00:00:00 2001
From: Brian Leung <[email-masked]>
Date: Tue, 8 Nov 2022 23:16:16 -0800
Subject: [PATCH 3/4] esh-mode: Add repeat-map for
 eshell-{forward,backward}-argument

* lisp/eshell/esh-mode.el (eshell-command-repeat-map): New defvar.
---
 lisp/eshell/esh-mode.el | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index 92523fd99e..4357a0e29a 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -280,6 +280,14 @@ eshell-command-map
   "C-w" #'backward-kill-word
   "C-y" #'eshell-repeat-argument)
 
+(defvar-keymap eshell-command-repeat-map
+  :doc "Keymap to repeat eshell-command key sequences.  Used in `repeat-mode'."
+  "C-f" #'eshell-forward-argument
+  "C-b" #'eshell-backward-argument)
+
+(put #'eshell-forward-argument 'repeat-map 'eshell-command-repeat-map)
+(put #'eshell-backward-argument 'repeat-map 'eshell-command-repeat-map)
+
 ;;; User Functions:
 
 (defun eshell-kill-buffer-function ()
-- 
2.38.1

>From 5bfa2e7c267b52c1cc59eb965850aac239a6eb0c Mon Sep 17 00:00:00 2001
From: Brian Leung <[email-masked]>
Date: Tue, 8 Nov 2022 23:18:23 -0800
Subject: [PATCH 4/4] shell: Add repeat-map for shell-{forward,backward}-prompt

* lisp/shell.el (shell-repeat-map): New defvar.
---
 lisp/shell.el | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lisp/shell.el b/lisp/shell.el
index 641f274045..7c3c925ab8 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -393,6 +393,14 @@ shell-mode-map
       'complete-expand)
     map))
 
+(defvar-keymap shell-repeat-map
+  :doc "Keymap to repeat shell key sequences.  Used in `repeat-mode'."
+  "C-f" #'shell-forward-command
+  "C-b" #'shell-backward-command)
+
+(put #'shell-forward-command 'repeat-map 'shell-repeat-map)
+(put #'shell-backward-command 'repeat-map 'shell-repeat-map)
+
 (defcustom shell-mode-hook '()
   "Hook for customizing Shell mode."
   :type 'hook
-- 
2.38.1