Function: erc-extract-command-from-line

erc-extract-command-from-line is a byte-compiled function defined in erc.el.gz.

Signature

(erc-extract-command-from-line LINE)

Documentation

Extract command and args from the input LINE.

If no command was given, return nil. If command matches, return a list of the form: (command args) where both elements are strings.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-extract-command-from-line (line)
  "Extract command and args from the input LINE.
If no command was given, return nil.  If command matches, return a
list of the form: (command args) where both elements are strings."
  (when (string-match erc-command-regexp line)
    (let* ((cmd (erc-command-symbol (match-string 1 line)))
           ;; note: return is nil, we apply this simply for side effects
           (_canon-defun (while (and cmd (symbolp (symbol-function cmd)))
                           (setq cmd (symbol-function cmd))))
           (cmd-fun (or cmd #'erc-cmd-default))
           (arg (if cmd
                    (if (get cmd-fun 'do-not-parse-args)
                        (format "%s" (match-string 2 line))
                      (delete "" (split-string (erc-trim-string
                                                (match-string 2 line)) " ")))
                  line)))
      (list cmd-fun arg))))