Function: erc-send-current-line

erc-send-current-line is an interactive and byte-compiled function defined in erc.el.gz.

Signature

(erc-send-current-line)

Documentation

Parse current line and send it to IRC.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc-send-current-line ()
  "Parse current line and send it to IRC."
  (interactive)
  (let ((now (current-time)))
    (if (or (not erc-accidental-paste-threshold-seconds)
            (time-less-p erc-accidental-paste-threshold-seconds
			 (time-subtract now erc-last-input-time)))
        (save-restriction
          ;; If there's an abbrev at the end of the line, expand it.
          (when (and abbrev-mode
                     (eolp))
            (expand-abbrev))
          (widen)
          (if-let* ((str (erc-user-input))
                    (msg (run-hook-with-args-until-success
                          'erc--check-prompt-input-functions str
                          (split-string str erc--input-line-delim-regexp))))
              (when (stringp msg)
                (erc-error msg))
            (let ((inhibit-read-only t)
                  (old-buf (current-buffer)))
              (progn ; unprogn this during next major surgery
                (erc-set-active-buffer (current-buffer))
                ;; Kill the input and the prompt
                (delete-region (erc-beg-of-input-line)
                               (erc-end-of-input-line))
                (unwind-protect
                    (erc-send-input str 'skip-ws-chk)
                  ;; Fix the buffer if the command didn't kill it
                  (when (buffer-live-p old-buf)
                    (with-current-buffer old-buf
                      (save-restriction
                        (widen)
                        (goto-char (point-max))
                        (when (processp erc-server-process)
                          (set-marker (process-mark erc-server-process) (point)))
                        (set-marker erc-insert-marker (point))
                        (let ((buffer-modified (buffer-modified-p)))
                          (erc-display-prompt)
                          (set-buffer-modified-p buffer-modified))))))

                ;; Only when last hook has been run...
                (run-hook-with-args 'erc-send-completed-hook str)))
            (setq erc-last-input-time now)))
      (switch-to-buffer "*ERC Accidental Paste Overflow*")
      (lwarn 'erc :warning
             "You seem to have accidentally pasted some text!"))))