Skip to content

Instantly share code, notes, and snippets.

Created Feb 4, 2014

What would you like to do?
Created with Christopher Biscardi's region-to-gist
;;; Region to Gist
(defun region-to-gist ()
"Sends region to Gist"
(if (region-active-p)
(gist-req (buffer-substring-no-properties (region-beginning) (region-end))))
(defun gist-test (buf)
(message "%S" `(:content ,buf)))
(defun gist-req (buf)
: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)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.