Skip to content

Commit

Permalink
Add an option to automatically open new gists in the browser.
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 authored and defunkt committed Nov 11, 2008
1 parent 5d117aa commit 9c63d81
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gist.el
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
(tex-mode . "tex") (tex-mode . "tex")
(xml-mode . "xml"))) (xml-mode . "xml")))


(defvar gist-view-gist nil
"If non-nil, automatically use `browse-url' to view gists after they're posted.")

;;;###autoload ;;;###autoload
(defun gist-region (begin end &optional private) (defun gist-region (begin end &optional private)
"Post the current region as a new paste at gist.github.com "Post the current region as a new paste at gist.github.com
Expand All @@ -71,6 +74,7 @@ Copies the URL into the kill ring."
(with-current-buffer output (with-current-buffer output
(re-search-backward "href=\"\\(.*\\)\"") (re-search-backward "href=\"\\(.*\\)\"")
(message "Paste created: %s" (match-string 1)) (message "Paste created: %s" (match-string 1))
(if gist-view-gist (browse-url (match-string 1)))
(kill-new (match-string 1))) (kill-new (match-string 1)))
(kill-buffer output))) (kill-buffer output)))


Expand Down

0 comments on commit 9c63d81

Please sign in to comment.