From 7c1dde6f1a620d3d4121fb4fb4389d21aa7bfe63 Mon Sep 17 00:00:00 2001 From: Akib Azmain Turja Date: Sun, 24 Sep 2023 21:28:46 +0600 Subject: [PATCH] Add command 'eat-send-password' * eat.el (eat-send-password): New command. * eat.texi (Password Input): New chapter. --- eat.el | 9 +++++++++ eat.texi | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/eat.el b/eat.el index 8539aab..401ba7b 100644 --- a/eat.el +++ b/eat.el @@ -5662,6 +5662,15 @@ EVENT is the mouse event." ;; Insert the text without putting it onto the kill ring. (eat-term-send-string-as-yank eat-terminal pasted-text)))) +(defun eat-send-password () + "Read password from minibuffer and send it to the terminal." + (declare (interactive-only t)) + (interactive) + (unless eat-terminal + (user-error "Process not running")) + (eat-term-send-string eat-terminal (read-passwd "Password: ")) + (eat-self-input 1 'return)) + ;; When changing these keymaps, be sure to update the manual, README ;; and commentary. (defvar eat-mode-map diff --git a/eat.texi b/eat.texi index 9954b94..08910c9 100644 --- a/eat.texi +++ b/eat.texi @@ -62,6 +62,7 @@ Basic Operations * Keyboard:: Most keyboard keys are captured by Eat. * Mouse:: Eat supports mouse. * Input Modes:: Input modes for various use-cases. +* Password Input:: Safely inputting credentials. Advanced Customizations * Shell Integration:: Getting the most from Eat and your shell. @@ -448,6 +449,25 @@ other parts of the Eat buffer, they search in the Eat buffer. If Input history is not loaded from the shell history file, to do that, @xref{Line Mode Integration}. +@node Password Input +@cindex password input +@cindex credential input +@cindex input, password +@cindex input, credential +@chapter Password Input + +By default, every keystroke gets recorded in the lossage, which can be +seen by pressing @kbd{C-h l}. This is actually a good thing, unless +you're inputting password. + +@findex eat-send-command +Emacs doesn't record keystrokes when a password is read from the +minibuffer. However, when the password prompt is in the terminal, the +keys you use to type in your password gets recorded. To prevent this +from happening, you can use the command @command{eat-send-command}, +it'll read password from the minibuffer and send it. Since the +password is read from the minibuffer, it's not recorded. + @part Part III:@* Advanced Customizations @node Shell Integration