Added github anonymous gists as provider. This fixes #8.

master
Elis Axelsson 9 years ago
parent 8905a5264d
commit 2dc220686e
No known key found for this signature in database
GPG Key ID: D57EFA625C9A925F
  1. 3
      README.org
  2. 22
      webpaste.el

@ -22,7 +22,7 @@ easiest way to install and configure packages.
("C-c C-p C-r" . webpaste-paste-region))) ("C-c C-p C-r" . webpaste-paste-region)))
#+END_SRC #+END_SRC
** TODO Providers to implement [5/8] ** TODO Providers to implement [6/9]
- [X] ptpb.pw - [X] ptpb.pw
- [X] ix.io - [X] ix.io
- [X] dpaste.com - [X] dpaste.com
@ -31,3 +31,4 @@ easiest way to install and configure packages.
- [ ] paste.pound-python.org - [ ] paste.pound-python.org
- [ ] paste.debian.net - [ ] paste.debian.net
- [ ] bpaste.net - [ ] bpaste.net
- [X] gist.github.com

@ -7,7 +7,7 @@
;; Package-Version: 1.2.1 ;; Package-Version: 1.2.1
;; Version: 1.2.1 ;; Version: 1.2.1
;; Keywords: convenience, comm, paste ;; Keywords: convenience, comm, paste
;; Package-Requires: ((emacs "24.4") (request "0.2.0") (cl-lib "0.5")) ;; Package-Requires: ((emacs "24.4") (request "0.2.0") (cl-lib "0.5") (json "1.4"))
;;; Commentary: ;;; Commentary:
@ -36,6 +36,7 @@
;;; Code: ;;; Code:
(require 'request) (require 'request)
(require 'cl-lib) (require 'cl-lib)
(require 'json)
@ -100,7 +101,6 @@ each run.")
(cl-defun webpaste-provider (&key uri (cl-defun webpaste-provider (&key uri
post-field post-field
success-lambda success-lambda
@ -196,7 +196,23 @@ Optional params:
("format" . "url") ("format" . "url")
("expires" . 86400)) ("expires" . 86400))
:post-field "content" :post-field "content"
:success-lambda webpaste/providers-success-returned-string))) :success-lambda webpaste/providers-success-returned-string))
("gist.github.com"
,(webpaste-provider
:uri "https://api.github.com/gists"
:post-field nil
:post-field-lambda (lambda (text post-field post-data)
(json-encode `(("description" . "Pasted from Emacs with webpaste.el")
("public" . "true")
("files" .
(("file.txt" .
(("content" . ,text))))))))
:success-lambda (cl-function (lambda (&key data &allow-other-keys)
(message "fubar")
(when data
(webpaste-return-url
(cdr (assoc 'html_url (json-read-from-string data))))))))))
"Define all webpaste.el providers. "Define all webpaste.el providers.
Consists of provider name and lambda function to do the actuall call to the Consists of provider name and lambda function to do the actuall call to the

Loading…
Cancel
Save