From 575a326334b9504873cd5c18844676c76e5daef2 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 25 Feb 2017 23:32:07 -0500 Subject: Transition to notmuch for main mail setup --- lisp/km-util.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lisp/km-util.el') diff --git a/lisp/km-util.el b/lisp/km-util.el index 40672d7..1678161 100644 --- a/lisp/km-util.el +++ b/lisp/km-util.el @@ -45,5 +45,21 @@ point in the buffer." (progn (goto-char (region-end)) (1+ (point-at-eol)))) (list (point-min) (point-max)))) +(defun km/open-github-patch (buffer) + "Find GitHub patch link in BUFFER and show it in a new buffer." + (let ((url + (with-current-buffer buffer + (save-excursion + (goto-char (point-min)) + (if (re-search-forward "https://github.com/.*\\.patch" nil t) + (match-string-no-properties 0) + (user-error "No patch found")))))) + (with-current-buffer (get-buffer-create + (generate-new-buffer-name "*mail-github-patch*")) + (url-insert-file-contents url) + (diff-mode) + (view-mode 1) + (pop-to-buffer (current-buffer))))) + (provide 'km-util) ;;; km-util.el ends here -- cgit v1.2.3