Created
September 23, 2010 04:18
-
-
Save tobias/593091 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun yank-to-gist () | |
"yank from the top of the kill ring, create a gist from it, and insert the gist url at the point" | |
(interactive) | |
(save-excursion | |
(let ((buffer (current-buffer))) | |
(set-buffer (get-buffer-create "*yank-to-gist*")) | |
(yank) | |
(gist-region | |
(point-min) | |
(point-max) | |
t | |
(lexical-let ((buf buffer)) | |
(function (lambda (status) | |
(let ((location (cadr status))) | |
(set-buffer buf) | |
(message "Paste created: %s" location) | |
(insert location) | |
(kill-new location)))))) | |
(kill-buffer)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment