Function: comint-watch-for-password-prompt

comint-watch-for-password-prompt is a byte-compiled function defined in comint.el.gz.

Signature

(comint-watch-for-password-prompt STRING)

Documentation

Prompt in the minibuffer for password and send without echoing.

Looks for a match to comint-password-prompt-regexp in order to detect the need to (prompt and) send a password. Ignores any carriage returns (\r) in STRING.

This function could be in the list comint-output-filter-functions.

Probably introduced at or before Emacs version 19.24.

Source Code

;; Defined in /usr/src/emacs/lisp/comint.el.gz
(defun comint-watch-for-password-prompt (string)
  "Prompt in the minibuffer for password and send without echoing.
Looks for a match to `comint-password-prompt-regexp' in order
to detect the need to (prompt and) send a password.  Ignores any
carriage returns (\\r) in STRING.

This function could be in the list `comint-output-filter-functions'."
  (when (let ((case-fold-search t))
	  (string-match comint-password-prompt-regexp
                        (string-replace "\r" "" string)))
    ;; Use `run-at-time' in order not to pause execution of the
    ;; process filter with a minibuffer
    (run-at-time
     0 nil
     (lambda (current-buf)
       (with-current-buffer current-buf
         (let ((comint--prompt-recursion-depth
                (1+ comint--prompt-recursion-depth)))
           (if (> comint--prompt-recursion-depth 10)
               (message "Password prompt recursion too deep")
             (when (get-buffer-process (current-buffer))
               (comint-send-invisible
                (string-trim string "[ \n\r\t\v\f\b\a]+" "\n+")))))))
     (current-buffer))))