Function: erc-send-input
erc-send-input is a byte-compiled function defined in erc.el.gz.
Signature
(erc-send-input INPUT &optional SKIP-WS-CHK)
Documentation
Treat INPUT as typed in by the user.
It is assumed that the input and the prompt is already deleted. Return non-nil only if we actually send anything.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-send-input (input &optional skip-ws-chk)
"Treat INPUT as typed in by the user.
It is assumed that the input and the prompt is already deleted.
Return non-nil only if we actually send anything."
;; Handle different kinds of inputs
(if (and (not skip-ws-chk)
(erc--check-prompt-input-for-multiline-blanks
input (split-string input erc--input-line-delim-regexp)))
(when erc-warn-about-blank-lines
(message "Blank line - ignoring...") ; compat
(beep))
;; This dynamic variable is used by `erc-send-pre-hook'. It's
;; obsolete, and when it's finally removed, this binding should
;; also be removed.
(with-suppressed-warnings ((lexical str))
(defvar str))
(let ((str input)
(erc-insert-this t)
(erc-send-this t)
state)
;; The calling convention of `erc-send-pre-hook' is that it
;; should change the dynamic variable `str' or set
;; `erc-send-this' to nil. This has now been deprecated:
;; Instead `erc-pre-send-functions' is used as a filter to do
;; allow both changing and suppressing the string.
(run-hook-with-args 'erc-send-pre-hook input)
(setq state (make-erc-input :string str ;May be != from `input' now!
:insertp erc-insert-this
:sendp erc-send-this))
(run-hook-with-args 'erc-pre-send-functions state)
(when (and (erc-input-sendp state)
erc-send-this)
(if-let* ((first (split-string (erc-input-string state)
erc--input-line-delim-regexp))
(split (mapcan #'erc--split-line first))
(lines (nreverse (seq-drop-while #'string-empty-p
(nreverse split))))
((string-match erc-command-regexp (car lines))))
(progn
;; Asking users what to do here might make more sense.
(cl-assert (not (cdr lines)))
;; The `force' arg (here t) is ignored for command lines.
(erc-process-input-line (concat (car lines) "\n") t nil))
(progn ; temporarily preserve indentation
(dolist (line lines)
(progn ; temporarily preserve indentation
(when (erc-input-insertp state)
(erc-display-msg line))
(erc-process-input-line (concat line "\n")
(null erc-flood-protect) t))))
t)))))