Subject: [PATCH] Add repeat-map for comint and eshell

From: Brian Leung <[email-masked]>
Date: Wed, 09 Nov 2022 06:16:45 +0000

Tags: patch

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
version 1.16.0, Xaw3d scroll bars)
Repository revision: 68e2a9cd92996dd55ff9599dc1bf99c70070cddb
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12014000
System Description: NixOS 22.11 (Raccoon)

Configured using:
 'configure
 --prefix=/nix/store/1bs9w4lkx78fsln68yg51y5i8a1czfjj-emacs-git-20221108.0
 --disable-build-details --with-modules --with-x-toolkit=lucid
 --with-xft --with-cairo --with-native-compilation'

>From 50a276b3839569c6c9f61e81e1771e958e7fd9c0 Mon Sep 17 00:00:00 2001
From: Brian Leung <[email-masked]>
Date: Tue, 8 Nov 2022 22:03:29 -0800
Subject: [PATCH 1/2] comint: Add repeat-map for comint

* 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 0fa475101f29c7e2984b23dc490b7d6d593a98d1 Mon Sep 17 00:00:00 2001
From: Brian Leung <[email-masked]>
Date: Tue, 8 Nov 2022 22:11:15 -0800
Subject: [PATCH 2/2] em-prompt: Add repeat-map for em-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