From 775328790cb48e78f0035d1234d568ad3612c175 Mon Sep 17 00:00:00 2001 From: Akib Azmain Turja Date: Sun, 4 Dec 2022 19:32:14 +0600 Subject: [PATCH] Remap 'insert-char' to read and input a character * eat.el (eat-input-char): New function. * eat.el (eat-semi-char-mode-map) (eat-eshell-semi-char-mode-map): Remap 'insert-char' to 'eat-input-char'. --- eat.el | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/eat.el b/eat.el index 1f937ea..3346138 100644 --- a/eat.el +++ b/eat.el @@ -4035,7 +4035,7 @@ event." (eat-term-input-event eat--terminal n e)))) (defun eat-quoted-input () - "Read a char and send it as INPUT." + "Read a character and send it as INPUT." (declare (interactive-only "Use `eat-self-input' instead.")) (interactive) ;; HACK: Quick hack to allow inputting `C-g'. Any better way to do @@ -4046,6 +4046,17 @@ event." (quit-flag nil)) (read-event)))) +(defun eat-input-char (character count) + "Input CHARACTER, COUNT times. + +Interactively, ask for the character CHARACTER to input. The numeric prefix +argument COUNT specifies how many times to insert CHARACTER." + (declare (interactive-only "Use `eat-self-input' instead.")) + (interactive (list (read-char-by-name + "Insert character (Unicode name or hex): ") + (prefix-numeric-value current-prefix-arg))) + (eat-self-input count character)) + (defun eat-yank (&optional arg) "Same as `yank', but for Eat. @@ -4114,6 +4125,7 @@ ARG is passed to `yank-pop', which see." (define-key map [?\M-y] #'eat-yank-pop) (define-key map [?\C-c ?\C-c] #'eat-self-input) (define-key map [?\C-c ?\C-e] #'eat-emacs-mode) + (define-key map [remap insert-char] #'eat-input-char) map) "Keymap for Eat semi-char mode.") @@ -4708,6 +4720,7 @@ PROGRAM can be a shell command." (define-key map [?\C-y] #'eat-yank) (define-key map [?\M-y] #'eat-yank-pop) (define-key map [?\C-c ?\C-e] #'eat-eshell-emacs-mode) + (define-key map [remap insert-char] #'eat-input-char) map) "Keymap for Eat Eshell semi-char mode.")