Книга: Learning GNU Emacs, 3rd Edition

5.1.2.2 Making passwords invisible in shell mode

5.1.2.2 Making passwords invisible in shell mode

By default, shell mode displays everything you type and that includes passwords—not a good situation if someone is peering over your shoulder. There is a way around this problem, however. Before you type the password, type M-x send-invisible. Emacs asks for the nonechoed text. When you type a character, Emacs puts an asterisk in the minibuffer. Press Enter and Emacs enters the password without displaying it. To have Emacs hide passwords as you type them, add the following two lines to your .emacs file:

(add-hook 'comint-output-filter-functions
   'comint-watch-for-password-prompt)

Emacs asks for nonechoed text in the minibuffer whenever a password prompt appears on the screen, making sure that the password is never displayed. Table 5-1 summarizes shell mode commands.

Table 5-1. Shell mode commands

Keystrokes Command name Action
(none) shell Enter shell mode.
C-c C-c Signals ? BREAK comint-interrupt-subjob Interrupt current job; equivalent to C-c.
C-d comint-delchar-or-maybe-eof Send EOF character if at end of buffer; delete a character elsewhere.
C-c C-d Signals ? EOF comint-send-eof Send EOF character.
C-c C-u comint-kill-input Erase current line; equivalent to C-u in Unix shells.
C-c C-z Signals ? STOP comint-stop-subjob Suspend or stop a job; C-z in Unix shells.
M-p In/Out ? Previous Input comint-previous-input Retrieve previous commands (can be repeated to find earlier commands).
M-n In/Out ? Next Input comint-next-input Retrieve subsequent commands (can be repeated to find more recent commands).
Enter comint-send-input Send input on current line.
Tab comint-dynamic-complete Complete current command, filename, or variable name.
C-c C-o In/Out ? Delete Current Output Group comint-kill-output Delete output from last command.
C-c C-r comint-show-output Move first line of output to top of window.
C-c C-e In/Out ? Show Maximum Output comint-show-maximum-output Move last line of output to bottom of window.
C-c C-p In/Out ? Backward Output Group comint-previous-prompt Move to previous command.
C-c C-n In/Out ? Forward Output Group comint-next-prompt Move to next command.

Оглавление книги

Оглавление статьи/книги

Генерация: 1.102. Запросов К БД/Cache: 3 / 1
поделиться
Вверх Вниз