diff options
author | Kyle Meyer <kyle@kyleam.com> | 2017-02-25 23:32:07 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2017-03-01 00:00:41 -0500 |
commit | 575a326334b9504873cd5c18844676c76e5daef2 (patch) | |
tree | a881dbba127879428b283b0d6ff85a65864cf225 /lisp/km-util.el | |
parent | f4c304c8543c6805fbd0569e8d710d7b32e91a23 (diff) | |
download | emacs.d-575a326334b9504873cd5c18844676c76e5daef2.tar.gz |
Transition to notmuch for main mail setup
Diffstat (limited to 'lisp/km-util.el')
-rw-r--r-- | lisp/km-util.el | 16 |
1 files changed, 16 insertions, 0 deletions
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 |