From 8fce8385da33a998f37307031ef78d870067a914 Mon Sep 17 00:00:00 2001 From: yoctocell Date: Sun, 3 Jan 2021 20:14:58 +0100 Subject: Add function to extract diff * git-email.el (git-email--extract-diff): Init --- git-email.el | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'git-email.el') 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) -- cgit v1.2.3