Permalink
Browse files

Add an option to automatically open new gists in the browser.

  • Loading branch information...
1 parent 5d117aa commit 9c63d81ee835d1de882e9381e59271ecd47924ff @nex3 nex3 committed with defunkt Oct 26, 2008
Showing with 4 additions and 0 deletions.
  1. +4 −0 gist.el
View
@@ -45,6 +45,9 @@
(tex-mode . "tex")
(xml-mode . "xml")))
+(defvar gist-view-gist nil
+ "If non-nil, automatically use `browse-url' to view gists after they're posted.")
+
;;;###autoload
(defun gist-region (begin end &optional private)
"Post the current region as a new paste at gist.github.com
@@ -71,6 +74,7 @@ Copies the URL into the kill ring."
(with-current-buffer output
(re-search-backward "href=\"\\(.*\\)\"")
(message "Paste created: %s" (match-string 1))
+ (if gist-view-gist (browse-url (match-string 1)))
(kill-new (match-string 1)))
(kill-buffer output)))

0 comments on commit 9c63d81

Please sign in to comment.