| Paste number 28554: | (defun erc-yank (&optional arg) |
| Pasted by: | pjb |
| When: | 2 years, 8 months ago |
| Share: | Tweet this! | http://paste.lisp.org/+M16 |
| Channel: | #sandbox |
| Paste contents: |
(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.