Function: erc-process-input-line
erc-process-input-line is a byte-compiled function defined in
erc.el.gz.
Signature
(erc-process-input-line LINE &optional FORCE NO-COMMAND)
Documentation
Dispatch a slash-command or chat-input handler from user-input LINE.
If simplistic validation fails, print an error and return nil.
Otherwise, defer to an appropriate handler. For "slash" commands,
like "/JOIN", expect a handler, like erc-cmd-JOIN, to return non-nil
if LINE is fit for echoing as a command line when executing scripts.
For normal chat input, expect a handler to return non-nil if a message
was successfully processed as an outgoing "PRIVMSG". If LINE is a
slash command, and ERC can't find a corresponding handler of the form
erc-cmd-<COMMAND>, pass LINE to erc-cmd-default, treating it as a
catch-all handler. Otherwise, for normal chat input, pass LINE and the
boolean argument FORCE to erc-send-input-line-function. With a
non-nil NO-COMMAND, always treat LINE as normal chat input rather than a
slash command.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-process-input-line (line &optional force no-command)
"Dispatch a slash-command or chat-input handler from user-input LINE.
If simplistic validation fails, print an error and return nil.
Otherwise, defer to an appropriate handler. For \"slash\" commands,
like \"/JOIN\", expect a handler, like `erc-cmd-JOIN', to return non-nil
if LINE is fit for echoing as a command line when executing scripts.
For normal chat input, expect a handler to return non-nil if a message
was successfully processed as an outgoing \"PRIVMSG\". If LINE is a
slash command, and ERC can't find a corresponding handler of the form
`erc-cmd-<COMMAND>', pass LINE to `erc-cmd-default', treating it as a
catch-all handler. Otherwise, for normal chat input, pass LINE and the
boolean argument FORCE to `erc-send-input-line-function'. With a
non-nil NO-COMMAND, always treat LINE as normal chat input rather than a
slash command."
(let ((command-list (erc-extract-command-from-line line)))
(if (and command-list
(not no-command))
(let* ((cmd (nth 0 command-list))
(args (nth 1 command-list))
(erc--called-as-input-p t))
(erc--server-last-reconnect-display-reset (erc-server-buffer))
(condition-case nil
(if (listp args)
(apply cmd args)
(funcall cmd args))
(wrong-number-of-arguments
(erc-display-message nil 'error (current-buffer) 'incorrect-args
?c (erc-command-name cmd)
?u (or (erc-get-arglist cmd)
"")
?d (format "%s\n"
(or (documentation cmd) "")))
nil)))
(let ((r (erc-default-target)))
(if r
(funcall erc-send-input-line-function r line force)
(erc-display-message nil '(notice error) (current-buffer) 'no-target)
nil)))))