emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/eat 775328790c 3/4: Remap 'insert-char' to read and input


From: ELPA Syncer
Subject: [nongnu] elpa/eat 775328790c 3/4: Remap 'insert-char' to read and input a character
Date: Sun, 4 Dec 2022 12:58:33 -0500 (EST)

branch: elpa/eat
commit 775328790cb48e78f0035d1234d568ad3612c175
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>

    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 1f937ea8f2..33461386f9 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.")
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]