From ce481dee7327c6ee4809370658009ee29994adcb Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 23 May 2020 11:07:19 -0700 Subject: notmuch-slurp-debbug: invoke notmuch to find the thread-id Signed-off-by: Sean Whitton --- debian/changelog | 4 ++++ mailscripts.el | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index a38fe6d..7363245 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,10 @@ mailscripts (0.20-2) UNRELEASED; urgency=medium - new command: notmuch-slurp-debbug-at-point - notmuch-slurp-this-debbug: if fail to extract bug number from subject line, prompt user for one + - notmuch-slurp-debbug: invoke notmuch to determine the thread-id + rather than passing the search query directly to `notmuch-show'. + That is not how `notmuch-show' is meant to be called and can result + in strange behaviour. -- Sean Whitton Sat, 23 May 2020 10:49:57 -0700 diff --git a/mailscripts.el b/mailscripts.el index 36f5732..50e3b89 100644 --- a/mailscripts.el +++ b/mailscripts.el @@ -54,7 +54,15 @@ If NO-OPEN, don't open the thread." (interactive "sBug number: ") (call-process-shell-command (concat "notmuch-slurp-debbug " bug)) (unless no-open - (notmuch-show (concat "Bug#" bug)))) + (let* ((search (concat "Bug#" bug)) + (thread-id (car (process-lines notmuch-command + "search" + "--output=threads" + "--limit=1" + "--format=text" + "--format-version=4" search)))) + (notmuch-show thread-id nil nil nil + (concat "*notmuch-show-" search "*"))))) ;;;###autoload (defun notmuch-slurp-debbug-at-point () -- cgit v1.2.3