aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/comint.el
diff options
context:
space:
mode:
authorMiles Bader2004-10-22 10:13:52 +0000
committerMiles Bader2004-10-22 10:13:52 +0000
commit5ea24f9468ea9fb01253a98343a67fdb74d1817e (patch)
tree434ee6dc5f051d6deaf0c357b97b656d16e4ed12 /lisp/comint.el
parent56c68b971d6f7665dd035df1ff302d794c0f294a (diff)
parentd5ddd795bdab373fe62ccfd099c270fd97da0964 (diff)
downloademacs-5ea24f9468ea9fb01253a98343a67fdb74d1817e.tar.gz
emacs-5ea24f9468ea9fb01253a98343a67fdb74d1817e.zip
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-62
Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-616 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-620 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-621 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-622 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-625 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-626 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-627 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-629 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-630 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-631 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-632 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-633 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-51 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-52 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-53 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-54 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-55 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-56 Update from CVS: Add lisp/legacy-gnus-agent.el * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-57 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-58 Update from CVS
Diffstat (limited to 'lisp/comint.el')
-rw-r--r--lisp/comint.el72
1 files changed, 7 insertions, 65 deletions
diff --git a/lisp/comint.el b/lisp/comint.el
index 8b2c779ecd3..16fd9782116 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -369,10 +369,10 @@ Takes one argument, the input. If non-nil, the input may be saved on the input
369history list. Default is to save anything that isn't all whitespace.") 369history list. Default is to save anything that isn't all whitespace.")
370 370
371(defvar comint-input-filter-functions '() 371(defvar comint-input-filter-functions '()
372 "Special hook run before input is sent to the process. 372 "Abnormal hook run before input is sent to the process.
373These functions get one argument, a string containing the text to send.") 373These functions get one argument, a string containing the text to send.")
374 374
375(defvar comint-output-filter-functions '(comint-postoutput-scroll-to-bottom) 375(defvar comint-output-filter-functions '(comint-postoutput-scroll-to-bottom comint-watch-for-password-prompt)
376 "Functions to call after output is inserted into the buffer. 376 "Functions to call after output is inserted into the buffer.
377One possible function is `comint-postoutput-scroll-to-bottom'. 377One possible function is `comint-postoutput-scroll-to-bottom'.
378These functions get one argument, a string containing the text as originally 378These functions get one argument, a string containing the text as originally
@@ -788,7 +788,7 @@ buffer. The hook `comint-exec-hook' is run after each exec."
788 788
789(defun comint-insert-input (&optional event) 789(defun comint-insert-input (&optional event)
790 "In a Comint buffer, set the current input to the previous input at point." 790 "In a Comint buffer, set the current input to the previous input at point."
791 (interactive (list last-input-event)) 791 (interactive "@")
792 (if event (mouse-set-point event)) 792 (if event (mouse-set-point event))
793 (let ((pos (point))) 793 (let ((pos (point)))
794 (if (not (eq (get-char-property pos 'field) 'input)) 794 (if (not (eq (get-char-property pos 'field) 'input))
@@ -1901,65 +1901,7 @@ prompt skip is done by skipping text matching the regular expression
1901 1901
1902;; These three functions are for entering text you don't want echoed or 1902;; These three functions are for entering text you don't want echoed or
1903;; saved -- typically passwords to ftp, telnet, or somesuch. 1903;; saved -- typically passwords to ftp, telnet, or somesuch.
1904;; Just enter m-x send-invisible and type in your line, or add 1904;; Just enter m-x send-invisible and type in your line.
1905;; `comint-watch-for-password-prompt' to `comint-output-filter-functions'.
1906
1907(defun comint-read-noecho (prompt &optional stars)
1908 "Read a single line of text from user without echoing, and return it.
1909Prompt with argument PROMPT, a string. Optional argument STARS causes
1910input to be echoed with '*' characters on the prompt line. Input ends with
1911RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line. C-g aborts (if
1912`inhibit-quit' is set because e.g. this function was called from a process
1913filter and C-g is pressed, this function returns nil rather than a string).
1914
1915Note that the keystrokes comprising the text can still be recovered
1916\(temporarily) with \\[view-lossage]. Some people find this worrisome (see,
1917however, `clear-this-command-keys').
1918Once the caller uses the password, it can erase the password
1919by doing (clear-string STRING)."
1920 (let ((ans "")
1921 (newans nil)
1922 (c 0)
1923 (echo-keystrokes 0)
1924 (cursor-in-echo-area t)
1925 (message-log-max nil)
1926 (done nil))
1927 (while (not done)
1928 (if stars
1929 (message "%s%s" prompt (make-string (length ans) ?*))
1930 (message "%s" prompt))
1931 ;; Use this instead of `read-char' to avoid "Non-character input-event".
1932 (setq c (read-char-exclusive))
1933 (cond ((= c ?\C-g)
1934 ;; This function may get called from a process filter, where
1935 ;; inhibit-quit is set. In later versions of emacs read-char
1936 ;; may clear quit-flag itself and return C-g. That would make
1937 ;; it impossible to quit this loop in a simple way, so
1938 ;; re-enable it here (for backward-compatibility the check for
1939 ;; quit-flag below would still be necessary, so this seems
1940 ;; like the simplest way to do things).
1941 (setq quit-flag t
1942 done t))
1943 ((or (= c ?\r) (= c ?\n) (= c ?\e))
1944 (setq done t))
1945 ((= c ?\C-u)
1946 (clear-string ans)
1947 (setq ans ""))
1948 ((and (/= c ?\b) (/= c ?\177))
1949 (setq newans (concat ans (char-to-string c)))
1950 (clear-string ans)
1951 (setq ans newans))
1952 ((> (length ans) 0)
1953 (aset ans (1- (length ans)) 0)
1954 (setq ans (substring ans 0 -1)))))
1955 (if quit-flag
1956 ;; Emulate a true quit, except that we have to return a value.
1957 (prog1
1958 (setq quit-flag nil)
1959 (message "Quit")
1960 (beep t))
1961 (message "")
1962 ans)))
1963 1905
1964(defun send-invisible (&optional prompt) 1906(defun send-invisible (&optional prompt)
1965 "Read a string without echoing. 1907 "Read a string without echoing.
@@ -1970,7 +1912,7 @@ Security bug: your string can still be temporarily recovered with
1970 (interactive "P") ; Defeat snooping via C-x ESC ESC 1912 (interactive "P") ; Defeat snooping via C-x ESC ESC
1971 (let ((proc (get-buffer-process (current-buffer)))) 1913 (let ((proc (get-buffer-process (current-buffer))))
1972 (if proc 1914 (if proc
1973 (let ((str (comint-read-noecho (or prompt "Non-echoed text: ") t))) 1915 (let ((str (read-passwd (or prompt "Non-echoed text: "))))
1974 (if (stringp str) 1916 (if (stringp str)
1975 (progn 1917 (progn
1976 (comint-snapshot-last-prompt) 1918 (comint-snapshot-last-prompt)
@@ -2340,7 +2282,7 @@ preceding newline is removed."
2340 2282
2341(defun comint-kill-whole-line (&optional arg) 2283(defun comint-kill-whole-line (&optional arg)
2342 "Kill current line, ignoring read-only and field properties. 2284 "Kill current line, ignoring read-only and field properties.
2343With prefix ARG, kill that many lines starting from the current line. 2285With prefix arg, kill that many lines starting from the current line.
2344If arg is negative, kill backward. Also kill the preceding newline, 2286If arg is negative, kill backward. Also kill the preceding newline,
2345instead of the trailing one. \(This is meant to make \\[repeat] work well 2287instead of the trailing one. \(This is meant to make \\[repeat] work well
2346with negative arguments.) 2288with negative arguments.)
@@ -2488,7 +2430,7 @@ Provides a default, if there is one, and returns the result filename.
2488 2430
2489See `comint-source-default' for more on determining defaults. 2431See `comint-source-default' for more on determining defaults.
2490 2432
2491PROMPT is the prompt string. PREV-DIR/FILE is the (directory . file) pair 2433PROMPT is the prompt string. PREV-DIR/FILE is the (DIRECTORY . FILE) pair
2492from the last source processing command. SOURCE-MODES is a list of major 2434from the last source processing command. SOURCE-MODES is a list of major
2493modes used to determine what file buffers contain source files. (These 2435modes used to determine what file buffers contain source files. (These
2494two arguments are used for determining defaults). If MUSTMATCH-P is true, 2436two arguments are used for determining defaults). If MUSTMATCH-P is true,