Created with Christopher Biscardi's region-to-gist
;;; Region to Gist | |
(defun region-to-gist () | |
"Sends region to Gist" | |
(interactive) | |
(if (region-active-p) | |
(gist-req (buffer-substring-no-properties (region-beginning) (region-end)))) | |
nil) | |
(defun gist-test (buf) | |
(message "%S" `(:content ,buf))) | |
(defun gist-req (buf) | |
(request | |
"https://api.github.com/gists" | |
:type "POST" | |
:data (json-encode `(:description "Created with Christopher Biscardi's region-to-gist" | |
:public t | |
:files (:example.el (:content ,buf)))) | |
;; :data "key=value&key2=value2" ; this is equivalent | |
:parser 'json-read | |
:success (function* | |
(lambda (&key data &allow-other-keys) | |
(message "I sent: %S" (assoc-default 'html_url data))))) | |
nil) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment