Function: erc-send-input

erc-send-input is a byte-compiled function defined in erc.el.gz.

Signature

(erc-send-input INPUT)

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)
  "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
  (cond
   ;; Ignore empty input
   ((if erc-send-whitespace-lines
        (string= input "")
      (string-match "\\`[ \t\r\f\n]*\\'" input))
    (when erc-warn-about-blank-lines
      (message "Blank line - ignoring...")
      (beep))
    nil)
   (t
    ;; 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)
	(let ((string (erc-input-string state)))
          (if (or (if (>= emacs-major-version 28)
                      (string-search "\n" string)
                    (string-match "\n" string))
                  (not (string-match erc-command-regexp string)))
              (mapc
               (lambda (line)
		 (mapc
                  (lambda (line)
                    ;; Insert what has to be inserted for this.
		    (when (erc-input-insertp state)
                      (erc-display-msg line))
                    (erc-process-input-line (concat line "\n")
                                            (null erc-flood-protect) t))
                  (or (and erc-flood-protect (erc-split-line line))
                      (list line))))
               (split-string string "\n"))
            (erc-process-input-line (concat string "\n") t nil))
          t))))))