Skip to content

Commit

Permalink
Add paste.rs support
Browse files Browse the repository at this point in the history
  • Loading branch information
wasamasa committed Jun 30, 2024
1 parent 7483f54 commit 1004640
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lui-autopaste.el
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,20 @@ replace it with the resulting URL."
(error "Error during pasting to 0x0.st")))
(kill-buffer buf)))))

(defun lui-autopaste-service-paste.rs (text)
"Paste TEXT to 0x0.st and return the paste url."
(let* ((url-request-method "POST")
(url-request-extra-headers `(("Content-Type" . "text/plain")))
(url-request-data text)
(url-http-attempt-keepalives nil))
(let ((buf (url-retrieve-synchronously "https://paste.rs/")))
(unwind-protect
(with-current-buffer buf
(goto-char (point-min))
(if (re-search-forward "\n\n" nil t)
(buffer-substring (point) (line-end-position))
(error "Error during pasting to paste.rs")))
(kill-buffer buf)))))

(provide 'lui-autopaste)
;;; lui-autopaste.el ends here

0 comments on commit 1004640

Please sign in to comment.