aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2003-12-29 13:42:37 +0000
committerEli Zaretskii2003-12-29 13:42:37 +0000
commit1015017fa09c279e29a2810cde1f9b8a91aed3d1 (patch)
tree4641c51c2fdc4b80cab89a63298bfa0c6a9f61e4
parent6b531f6fce334d3f872f0270c86a32b31951ea8e (diff)
downloademacs-1015017fa09c279e29a2810cde1f9b8a91aed3d1.tar.gz
emacs-1015017fa09c279e29a2810cde1f9b8a91aed3d1.zip
(comint-watch-for-password-prompt): Pass `string' as
arg to send-invisible (send-invisible): Doc fix. The argument is now a prompt, not the string to send. (comint-read-noecho): Doc fix.
-rw-r--r--lisp/comint.el28
1 files changed, 13 insertions, 15 deletions
diff --git a/lisp/comint.el b/lisp/comint.el
index 5509e71d984..bc9d2b017cb 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1901,7 +1901,8 @@ RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line. C-g aborts (if
1901filter and C-g is pressed, this function returns nil rather than a string). 1901filter and C-g is pressed, this function returns nil rather than a string).
1902 1902
1903Note that the keystrokes comprising the text can still be recovered 1903Note that the keystrokes comprising the text can still be recovered
1904\(temporarily) with \\[view-lossage]. Some people find this worrysome. 1904\(temporarily) with \\[view-lossage]. Some people find this worrysome (see,
1905however, `clear-this-command-keys').
1905Once the caller uses the password, it can erase the password 1906Once the caller uses the password, it can erase the password
1906by doing (clear-string STRING)." 1907by doing (clear-string STRING)."
1907 (let ((ans "") 1908 (let ((ans "")
@@ -1948,24 +1949,22 @@ by doing (clear-string STRING)."
1948 (message "") 1949 (message "")
1949 ans))) 1950 ans)))
1950 1951
1951(defun send-invisible (str) 1952(defun send-invisible (&optional prompt)
1952 "Read a string without echoing. 1953 "Read a string without echoing.
1953Then send it to the process running in the current buffer. 1954Then send it to the process running in the current buffer.
1954The string is sent using `comint-input-sender'. 1955The string is sent using `comint-input-sender'.
1955Security bug: your string can still be temporarily recovered with 1956Security bug: your string can still be temporarily recovered with
1956\\[view-lossage]." 1957\\[view-lossage]; `clear-this-command-keys' can fix that."
1957 (interactive "P") ; Defeat snooping via C-x ESC ESC 1958 (interactive "P") ; Defeat snooping via C-x ESC ESC
1958 (let ((proc (get-buffer-process (current-buffer)))) 1959 (let ((proc (get-buffer-process (current-buffer))))
1959 (cond ((not proc) 1960 (if proc
1960 (error "Current buffer has no process")) 1961 (let ((str (comint-read-noecho (or prompt "Non-echoed text: ") t)))
1961 ((stringp str) 1962 (if (stringp str)
1962 (comint-snapshot-last-prompt) 1963 (progn
1963 (funcall comint-input-sender proc str)) 1964 (comint-snapshot-last-prompt)
1964 (t 1965 (funcall comint-input-sender proc str))
1965 (let ((str (comint-read-noecho "Non-echoed text: " t))) 1966 (message "Warning: text will be echoed")))
1966 (if (stringp str) 1967 (error "Current buffer has no process"))))
1967 (send-invisible str)
1968 (message "Warning: text will be echoed")))))))
1969 1968
1970(defun comint-watch-for-password-prompt (string) 1969(defun comint-watch-for-password-prompt (string)
1971 "Prompt in the minibuffer for password and send without echoing. 1970 "Prompt in the minibuffer for password and send without echoing.
@@ -1977,8 +1976,7 @@ This function could be in the list `comint-output-filter-functions'."
1977 (when (string-match comint-password-prompt-regexp string) 1976 (when (string-match comint-password-prompt-regexp string)
1978 (when (string-match "^[ \n\r\t\v\f\b\a]+" string) 1977 (when (string-match "^[ \n\r\t\v\f\b\a]+" string)
1979 (setq string (replace-match "" t t string))) 1978 (setq string (replace-match "" t t string)))
1980 (let ((pw (comint-read-noecho string t))) 1979 (send-invisible string)))
1981 (send-invisible pw))))
1982 1980
1983;; Low-level process communication 1981;; Low-level process communication
1984 1982