Function: comint-send-invisible

comint-send-invisible is an interactive and byte-compiled function defined in comint.el.gz.

Signature

(comint-send-invisible &optional PROMPT)

Documentation

Read a string without echoing.

Then send it to the process running in the current buffer. The string is sent using comint-input-sender. Security bug: your string can still be temporarily recovered with C-h l (view-lossage); clear-this-command-keys can fix that.

View in manual

Probably introduced at or before Emacs version 27.1.

Key Bindings

Aliases

send-invisible (obsolete since 27.1)

Source Code

;; Defined in /usr/src/emacs/lisp/comint.el.gz
(defun comint-send-invisible (&optional prompt)
  "Read a string without echoing.
Then send it to the process running in the current buffer.
The string is sent using `comint-input-sender'.
Security bug: your string can still be temporarily recovered with
\\[view-lossage]; `clear-this-command-keys' can fix that."
  (interactive "P" comint-mode)			; Defeat snooping via C-x ESC ESC
  (let ((proc (get-buffer-process (current-buffer)))
	(prefix
	 (if (eq (window-buffer) (current-buffer))
	     ""
	   (format "(In buffer %s) "
		   (current-buffer)))))
    (if proc
	(let ((prefix-prompt (concat prefix
				     (or prompt "Non-echoed text: ")))
	      str)
	  (when comint-password-function
	    (setq str (funcall comint-password-function prefix-prompt)))
	  (unless str
	    (setq str (read-passwd prefix-prompt)))
	  (if (stringp str)
	      (progn
		(comint-snapshot-last-prompt)
		(funcall comint-input-sender proc str))
	    (message "Warning: text will be echoed")))
      (error "Buffer %s has no process" (current-buffer)))))