[Emacs] Bug?: notmuch-search-show-thread shows several threads; only one containing matching messages

Subject: [Emacs] Bug?: notmuch-search-show-thread shows several threads; only one containing matching messages

Date: Thu, 26 Jan 2012 01:40:24 +0100

To: notmuch

Cc:

From: Gregor Zattler


[sorry for the long and meandering explanation, I do not know how
to express the issue more concise]

Dear notmuch developers,

may someone please enlighten me regarding this behaviour: 

I experienced a situation where the Emacs interface shows three
(3) different threads in one notmuch show buffer.  I thought it
should show only one.  Perhaps this is the result of notmuch show
showing messages which do not match the search pattern and do not
belong to one thread which contains messages which do so.[1]


What I did:

I remembered a thread on the Emacs-orgmode mailing list about
date ranges in various Emacs implementations/compilations and
searched for it with this search expression:

folder:orgmode date 64 bit 32

it resulted in a *notmuch-search-folder:orgmode date 64 bit 32*
buffer containing 5 lines with matching threads, one of it with 7
out of 99 matching messages and the subject "[O]: dates before
1970", I selected this one with RET (notmuch-search-show-thread)
and got a notmuch show mode buffer.

The buffer begins with this thread (which is the one I
remembered: ~20 messages) but contains 2 more totally different
threads ("[O] Slow movement in large buffers" and "[O] The
Org->ODT exporter is now in Org's core") with no matching
messages at all (at least all of the messages are
invisible/folded).  The starting messages of these two additional
threads were shown with no indentation -- because they start a
thread.

I don't know for sure if the broad search pattern really does not
apply to at least some of the messages in the 2 additional
threads.[1]  But even if: why are they part of the same 
buffer resulting from notmuch-search-show-thread?

In order to further investigate this phenomenon I run notmuch from
the command line like:
notmuch show  --entire-thread  --format=mbox   folder:orgmode date 64 bit 32 >/tmp/date64.mbox

and opened the resulting mbox with mutt.  mutt showed the thread
I was interested in and several other threads which are not part
of this one.  I isolated the thread I was interested in,
extracted the message ids of its messages and greped the rest of
the messages for this message ids: no matches.[2] Therefore no of
the rests messages are part of the thread I was interested in but
some of them were also part of the notmuch show buffer alongside
the one thread I was interested in.

My expectation was to only see one thread: the one with the
matching messages.

So this about the Emacs interface and perhaps about what a
notmuch search matches.

Can somebody please explain this to me?  Since all relevant
messages are public I am able to provide the relevant messages as
one mbox file (2.9 MB).


Ciao, Gregor
-- 
[1] I don't know how to test if messages should show up in an
    notmuch serch query with "date bit 64 32" being the serach
    pattern.  When I did a rgrep -l -I date
    /tmp/unmatched.maildir|xargs egrep -l -I bit |xargs egrep -l
    -I 64|xargs egrep -l -I 32 I got many hits but this is to be
    expected since every e-mail has a "Date" header and enough
    headers to match "64" and "32" and since its a mailing list
    discussion software "bit" is also to be expected in these
    e-mails.

[2] grep -I "^Message-Id:" /tmp/thread-I-m-interested-in.mbox |sed -e "s/Message-Id: <//I" -e "s/>$//" >really.mid
    grep -I -F really.mid rest.mbox
    --> no match

Thread: