Paste number 28554: (defun erc-yank (&optional arg)

Paste number 28554: (defun erc-yank (&optional arg)
Pasted by: pjb
2 years, 2 months ago
#sandbox
Paste contents:
Raw Source | XML | Display As
(defun erc-yank (&optional arg)
  "Yank or lisppaste depending on the size of the yanked text.
When inside a erc channel buffer, if the text to yank is more than 3 lines,
then use http://paste.lisp.org to lisppaste it instead of yanking it.
Otherwise, just yank it.
"
  (interactive "*P")
  (if (erc-buffer-p (current-buffer))
      (if (paste-lisp-org-available-p)
          (let* ((text  (text-to-yank arg))
                 (lines (count +newline+ text)))
            (if (<= lines *erc-yank-flood-limit*)
                (funcall *erc-yank-function* arg)
                (multiple-value-bind
                      (url sent-p)
                    (lisp-paste (funcall (if (fboundp 'erc-network)
                                             'erc-network
                                             'erc-current-network))
                                (erc-buffer-channel (current-buffer))
                                (erc-current-nick)
                                text)
                  (unless sent-p
                    (insert-for-yank url)))))
          (funcall *erc-yank-function* arg))
      (funcall *erc-yank-function* arg)))


This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.