Add command 'eat-send-password'

* eat.el (eat-send-password): New command.
* eat.texi (Password Input): New chapter.
This commit is contained in:
Akib Azmain Turja 2023-09-24 21:28:46 +06:00
parent 1dfca821f5
commit 7c1dde6f1a
No known key found for this signature in database
GPG key ID: 5535FCF54D88616B
2 changed files with 29 additions and 0 deletions

9
eat.el
View file

@ -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

View file

@ -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