summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-01-07 14:49:01 -0500
committerKyle Meyer <kyle@kyleam.com>2014-01-07 14:49:01 -0500
commite9999d2909a21cb8f2b072346ce7477d1aa07e0d (patch)
tree00fe9fb8b52d722c97777117d10abc1fc8cfd595 /init
parentc39b68cf01f0534ed2310096c23efdd3e0cecac4 (diff)
downloademacs.d-e9999d2909a21cb8f2b072346ce7477d1aa07e0d.tar.gz
Function to open github patch from gnus
Diffstat (limited to 'init')
-rw-r--r--init/km-gnus.el31
1 files changed, 25 insertions, 6 deletions
diff --git a/init/km-gnus.el b/init/km-gnus.el
index 7258e36..b88f6d5 100644
--- a/init/km-gnus.el
+++ b/init/km-gnus.el
@@ -92,12 +92,7 @@
(defun km/follow-gwene-link ()
"Follow link at bottom of gwene message"
(interactive)
- ;; next 3 lines from gnus-sum.el guns-summary-widget-forward
- (gnus-summary-select-article)
- (gnus-configure-windows 'article)
- (select-window (gnus-get-buffer-window gnus-article-buffer))
-
- (goto-char (point-max))
+ (km/gnus-end-of-article-buffer)
(search-backward "Link")
(widget-button-press (point)))
@@ -106,6 +101,30 @@
(define-key gnus-article-mode-map
(kbd "C-c j") 'km/follow-gwene-link)
+(require 'url-handlers)
+
+(defun km/gnus-open-github-patch ()
+ "Open patch from github email.
+
+The patch is downloaded to a temporary file and then opened in
+another window."
+ (interactive)
+ (km/gnus-end-of-article-buffer)
+ (search-backward "patch")
+ (let ((url (thing-at-point 'url))
+ (patch-file (make-temp-file "gnus-github-" nil ".patch")))
+ (url-copy-file url patch-file t)
+ (find-file-other-window patch-file)
+ (view-mode 1)))
+
+(defun km/gnus-end-of-article-buffer ()
+ "Move point to the end of the article buffer."
+ ;; next 3 lines from gnus-sum.el `gnus-summary-widget-forward'
+ (gnus-summary-select-article)
+ (gnus-configure-windows 'article)
+ (select-window (gnus-get-buffer-window gnus-article-buffer))
+ (goto-char (point-max)))
+
(require 'notmuch)
(require 'org-gnus)