aboutsummaryrefslogtreecommitdiff
path: root/git-email.el
diff options
context:
space:
mode:
authoryoctocell <public@yoctocell.xyz>2021-01-03 20:14:58 +0100
committeryoctocell <public@yoctocell.xyz>2021-01-03 20:14:58 +0100
commit8fce8385da33a998f37307031ef78d870067a914 (patch)
tree9fc91d6ff583afc944564a12198ff4a057e9436e /git-email.el
parentcfed1ff81df6d08d635853e9be31be3a49657d94 (diff)
Add function to extract diff
* git-email.el (git-email--extract-diff): Init
Diffstat (limited to 'git-email.el')
-rw-r--r--git-email.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/git-email.el b/git-email.el
index 22f4ca9..1897bcd 100644
--- a/git-email.el
+++ b/git-email.el
@@ -44,6 +44,15 @@
(re-search-forward (format " *%s: +" header))
(point-at-eol))))
+(defun git-email--extract-diff (patch-file)
+ "Extract the diff from PATCH-FILE."
+ (with-temp-buffer
+ (insert-file-contents patch-file)
+ (goto-char (point-min))
+ (buffer-substring-no-properties
+ (- (re-search-forward "\n\n") 1)
+ (point-max))))
+
(defun git-email-send-email (patch-file)
"Given a PATCH-FILE, send an email."
(interactive)