From 8abe70c235f8c8b77f7fe7f57a56068dd44c905a Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 4 Feb 2024 14:54:47 -0500 Subject: *-am-ready-mbox: Don't require PATCH prefix All of the *-am-ready-mbox functions expect inline patches to have a '[... PATCH ...]' in the subject. In cases where a patch is sent without that prefix, a piem-am caller gets an unhelpful "Could not find am-ready mbox for current buffer" in response to piem-am-ready-mbox returning nil. To support these (hopefully rare) cases, drop the "has patch prefix?" guard from all the *-am-ready-mbox functions. A caller is requesting to extract a patch from the current buffer, and the "is the current buffer in the right mode?" check should be sufficient for an am-ready-mbox function to decide whether it should be responsible for generating the mbox. This added flexibility increases a caller's ability to apply invalid patches. As with the previously possible cases, the output buffer will give a clear error, but the caller will need to abort the git-am sequence and clean up the branch. That seems reasonable given that, in addition to the initial explicit request, an interactive piem-am caller needs to "confirm" applying through the prompts, making it more difficult to get to that state unintentionally. Reported-by: Leo Link: https://inbox.kyleam.com/piem/87fry9hn9u.fsf@ Message-ID: <87ttmo57js.fsf@kyleam.com> --- piem-gnus.el | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'piem-gnus.el') diff --git a/piem-gnus.el b/piem-gnus.el index 7120512..b6dc672 100644 --- a/piem-gnus.el +++ b/piem-gnus.el @@ -130,12 +130,8 @@ looks like a patch." (when-let ((patch (with-current-buffer gnus-article-buffer (save-restriction (widen) - (and (string-match-p - piem-patch-subject-re - (mail-decode-encoded-word-string - (message-field-value "subject"))) - (buffer-substring-no-properties - (point-min) (point-max))))))) + (buffer-substring-no-properties + (point-min) (point-max)))))) (cons (lambda () (insert patch)) "mbox")))))) -- cgit v1.2.3