From df23c5cbf295fb7f2441e2fe60ece14bab3df001 Mon Sep 17 00:00:00 2001 From: yoctocell Date: Sun, 3 Jan 2021 21:17:55 +0100 Subject: Add fail-safe for extracting header Some patches don't have the 'in-reply-to' header. * git-email.el (git-email--extract-header): If the header is not found, return an empty string. --- git-email.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/git-email.el b/git-email.el index a66fd16..40588e5 100644 --- a/git-email.el +++ b/git-email.el @@ -50,12 +50,15 @@ :type 'symbol) (defun git-email--extract-header (header patch-file) - "Extract HEADER from PATCH-FILE." + "Extract HEADER from PATCH-FILE. +If the header is not found, return an empty string." (with-temp-buffer (insert-file-contents patch-file) (goto-char (point-min)) (buffer-substring-no-properties - (re-search-forward (format " *%s: +" header)) + (if (re-search-forward (format " *%s: +" header) nil t) + (point) + (point-at-eol)) (point-at-eol)))) (defun git-email--extract-diff (patch-file) -- cgit v1.2.3