summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2019-11-21 14:30:43 -0700
committerSean Whitton <spwhitton@spwhitton.name>2019-11-21 14:30:43 -0700
commit8822515602bedcc4ce5b6a2428a2e506fdc0bf6d (patch)
tree7b598950c1462ee34532368cc29c64a24bc8a831
parent1eb413da0dc9ca57793e6daec03b6f373151eaff (diff)
downloadmailscripts-8822515602bedcc4ce5b6a2428a2e506fdc0bf6d.tar.gz
handle notmuch-show-thread-id not actually containing a thread ID
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--debian/changelog2
-rw-r--r--mailscripts.el12
2 files changed, 13 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 773e78f..69102fd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,8 @@ mailscripts (0.15-1) UNRELEASED; urgency=medium
right at the beginning of the Subject: field.
With mail forwarded by the Debian BTS, 'Bug#nnnnnn: ' is prepended to
the Subject: field.
+ * mailscripts.el: handle situation in which notmuch-show-thread-id
+ contains an arbitrary search query rather than the thread ID.
-- Sean Whitton <spwhitton@spwhitton.name> Thu, 21 Nov 2019 14:23:15 -0700
diff --git a/mailscripts.el b/mailscripts.el
index fa4c733..9c51f73 100644
--- a/mailscripts.el
+++ b/mailscripts.el
@@ -68,7 +68,17 @@ particular, this Emacs Lisp function supports passing only entire
threads to the notmuch-extract-patch(1) command."
(interactive
"Dgit repo: \nsbranch name (or leave blank to apply to current HEAD): \np")
- (let ((thread-id notmuch-show-thread-id)
+ (let ((thread-id
+ ;; If `notmuch-show' was called with a notmuch query rather
+ ;; than a thread ID, as `org-notmuch-follow-link' in
+ ;; org-notmuch.el does, then `notmuch-show-thread-id' might
+ ;; be an arbitrary notmuch query instead of a thread ID. We
+ ;; need to wrap such a query in thread:{} before passing it
+ ;; to notmuch-extract-patch(1), or we might not get a whole
+ ;; thread extracted (e.g. if the query is just id:foo)
+ (if (string= (substring notmuch-show-thread-id 0 7) "thread:")
+ notmuch-show-thread-id
+ (concat "thread:{" notmuch-show-thread-id "}")))
(default-directory (expand-file-name repo)))
(mailscripts--check-out-branch branch)
(shell-command