The first argument to `notmuch-show' is documented to be a notmuch thread ID,
not a notmuch query. If you pass a query then the buffer-local variable
`notmuch-show-thread-id' is populated with a value that is not a thread ID,
which breaks various other things.
`org-notmuch-follow-link' should continue to accept an arbitrary notmuch
query, because notmuch thread IDs are not stable.
ol-notmuch.el | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Notmuch thread IDs look like 'thread:000000000000f4a2'.
Previous discussion: https://firstname.lastname@example.org/
Full disclosure, the original author of ol-notmuch disagrees with me that it's
a problem in itself to be calling `notmuch-show' in a way that violates its
documented calling convention. But as there is a new maintainer, I thought
I'd raise this issue again. Thanks!
diff --git a/ol-notmuch.el b/ol-notmuch.el
index 471f651..28de660 100644
@@ -91,7 +91,10 @@ Should accept a notmuch search string as the sole argument."
(defun org-notmuch-follow-link (search)
"Follow a notmuch link to SEARCH.
Can link to more than one message, if so all matching messages are shown."
- (notmuch-show search))
+ (car (process-lines notmuch-command "search" "--output=threads" "--limit=1"
+ "--format=text" "--format-version=4" search))
+ nil nil search (format "*notmuch-%s*" search)))
;;; Search links