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

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

> On 11/8/2022 10:16 PM, Brian Leung wrote:
>> Tags: patch
>
> Thanks. For Eshell, there are a few other commands that might 
> make
> sense to have repeat-maps. For example, 
> 'eshell-forward-argument' (see
> 'eshell-command-map' in esh-mode.el). These are defined 
> differently,
> but hopefully repeat-mode can handle them...

OK, see attached for additional Eshell and shell patches.

>From 20f3c46b7475aa640d8af2d1f2c6384ffeb1c5fc Mon Sep 17 00:00:00 2001
From: Brian Leung <[email-masked]>
Date: Tue, 8 Nov 2022 23:16:16 -0800
Subject: [PATCH 1/2] 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 645aa7e78991adcf32dc4467ab397762f90fc859 Mon Sep 17 00:00:00 2001
From: Brian Leung <[email-masked]>
Date: Tue, 8 Nov 2022 23:18:23 -0800
Subject: [PATCH 2/2] 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..180a338216 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 eshell-command 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