/[emacs]/emacs/lisp/comint.el
ViewVC logotype

Diff of /emacs/lisp/comint.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.289.2.4 by miles, Thu Oct 14 08:50:01 2004 UTC revision 1.289.2.5 by miles, Fri Oct 22 10:13:29 2004 UTC
# Line 369  Takes one argument, the input.  If non-n Line 369  Takes one argument, the input.  If non-n
369  history list.  Default is to save anything that isn't all whitespace.")  history list.  Default is to save anything that isn't all whitespace.")
370    
371  (defvar comint-input-filter-functions '()  (defvar comint-input-filter-functions '()
372    "Special hook run before input is sent to the process.    "Abnormal hook run before input is sent to the process.
373  These functions get one argument, a string containing the text to send.")  These functions get one argument, a string containing the text to send.")
374    
375  (defvar comint-output-filter-functions '(comint-postoutput-scroll-to-bottom)  (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.    "Functions to call after output is inserted into the buffer.
377  One possible function is `comint-postoutput-scroll-to-bottom'.  One possible function is `comint-postoutput-scroll-to-bottom'.
378  These functions get one argument, a string containing the text as originally  These functions get one argument, a string containing the text as originally
# Line 788  buffer.  The hook `comint-exec-hook' is Line 788  buffer.  The hook `comint-exec-hook' is
788    
789  (defun comint-insert-input (&optional event)  (defun comint-insert-input (&optional event)
790    "In a Comint buffer, set the current input to the previous input at point."    "In a Comint buffer, set the current input to the previous input at point."
791    (interactive (list last-input-event))    (interactive "@")
792    (if event (mouse-set-point event))    (if event (mouse-set-point event))
793    (let ((pos (point)))    (let ((pos (point)))
794      (if (not (eq (get-char-property pos 'field) 'input))      (if (not (eq (get-char-property pos 'field) 'input))
# Line 1901  prompt skip is done by skipping text mat Line 1901  prompt skip is done by skipping text mat
1901    
1902  ;; These three functions are for entering text you don't want echoed or  ;; These three functions are for entering text you don't want echoed or
1903  ;; saved -- typically passwords to ftp, telnet, or somesuch.  ;; saved -- typically passwords to ftp, telnet, or somesuch.
1904  ;; Just enter m-x send-invisible and type in your line, or add  ;; Just enter m-x send-invisible and type in your line.
 ;; `comint-watch-for-password-prompt' to `comint-output-filter-functions'.  
   
 (defun comint-read-noecho (prompt &optional stars)  
   "Read a single line of text from user without echoing, and return it.  
 Prompt with argument PROMPT, a string.  Optional argument STARS causes  
 input to be echoed with '*' characters on the prompt line.  Input ends with  
 RET, LFD, or ESC.  DEL or C-h rubs out.  C-u kills line.  C-g aborts (if  
 `inhibit-quit' is set because e.g. this function was called from a process  
 filter and C-g is pressed, this function returns nil rather than a string).  
   
 Note that the keystrokes comprising the text can still be recovered  
 \(temporarily) with \\[view-lossage].  Some people find this worrisome (see,  
 however, `clear-this-command-keys').  
 Once the caller uses the password, it can erase the password  
 by doing (clear-string STRING)."  
   (let ((ans "")  
         (newans nil)  
         (c 0)  
         (echo-keystrokes 0)  
         (cursor-in-echo-area t)  
         (message-log-max nil)  
         (done nil))  
     (while (not done)  
       (if stars  
           (message "%s%s" prompt (make-string (length ans) ?*))  
         (message "%s" prompt))  
       ;; Use this instead of `read-char' to avoid "Non-character input-event".  
       (setq c (read-char-exclusive))  
       (cond ((= c ?\C-g)  
              ;; This function may get called from a process filter, where  
              ;; inhibit-quit is set.  In later versions of emacs read-char  
              ;; may clear quit-flag itself and return C-g.  That would make  
              ;; it impossible to quit this loop in a simple way, so  
              ;; re-enable it here (for backward-compatibility the check for  
              ;; quit-flag below would still be necessary, so this seems  
              ;; like the simplest way to do things).  
              (setq quit-flag t  
                    done t))  
             ((or (= c ?\r) (= c ?\n) (= c ?\e))  
              (setq done t))  
             ((= c ?\C-u)  
              (clear-string ans)  
              (setq ans ""))  
             ((and (/= c ?\b) (/= c ?\177))  
              (setq newans (concat ans (char-to-string c)))  
              (clear-string ans)  
              (setq ans newans))  
             ((> (length ans) 0)  
              (aset ans (1- (length ans)) 0)  
              (setq ans (substring ans 0 -1)))))  
     (if quit-flag  
         ;; Emulate a true quit, except that we have to return a value.  
         (prog1  
             (setq quit-flag nil)  
           (message "Quit")  
           (beep t))  
       (message "")  
       ans)))  
1905    
1906  (defun send-invisible (&optional prompt)  (defun send-invisible (&optional prompt)
1907    "Read a string without echoing.    "Read a string without echoing.
# Line 1970  Security bug: your string can still be t Line 1912  Security bug: your string can still be t
1912    (interactive "P")                     ; Defeat snooping via C-x ESC ESC    (interactive "P")                     ; Defeat snooping via C-x ESC ESC
1913    (let ((proc (get-buffer-process (current-buffer))))    (let ((proc (get-buffer-process (current-buffer))))
1914      (if proc      (if proc
1915          (let ((str (comint-read-noecho (or prompt "Non-echoed text: ") t)))          (let ((str (read-passwd (or prompt "Non-echoed text: "))))
1916            (if (stringp str)            (if (stringp str)
1917                (progn                (progn
1918                  (comint-snapshot-last-prompt)                  (comint-snapshot-last-prompt)
# Line 2340  preceding newline is removed." Line 2282  preceding newline is removed."
2282    
2283  (defun comint-kill-whole-line (&optional arg)  (defun comint-kill-whole-line (&optional arg)
2284    "Kill current line, ignoring read-only and field properties.    "Kill current line, ignoring read-only and field properties.
2285  With prefix ARG, kill that many lines starting from the current line.  With prefix arg, kill that many lines starting from the current line.
2286  If arg is negative, kill backward.  Also kill the preceding newline,  If arg is negative, kill backward.  Also kill the preceding newline,
2287  instead of the trailing one.  \(This is meant to make \\[repeat] work well  instead of the trailing one.  \(This is meant to make \\[repeat] work well
2288  with negative arguments.)  with negative arguments.)
# Line 2488  Provides a default, if there is one, and Line 2430  Provides a default, if there is one, and
2430    
2431  See `comint-source-default' for more on determining defaults.  See `comint-source-default' for more on determining defaults.
2432    
2433  PROMPT is the prompt string.  PREV-DIR/FILE is the (directory . file) pair  PROMPT is the prompt string.  PREV-DIR/FILE is the (DIRECTORY . FILE) pair
2434  from the last source processing command.  SOURCE-MODES is a list of major  from the last source processing command.  SOURCE-MODES is a list of major
2435  modes used to determine what file buffers contain source files.  (These  modes used to determine what file buffers contain source files.  (These
2436  two arguments are used for determining defaults).  If MUSTMATCH-P is true,  two arguments are used for determining defaults).  If MUSTMATCH-P is true,

Legend:
Removed from v.1.289.2.4  
changed lines
  Added in v.1.289.2.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26