Re: [PATCH] emacs: add new option notmuch-search-exclude

Subject: Re: [PATCH] emacs: add new option notmuch-search-exclude

Date: Sun, 24 Jul 2022 21:59:28 +0100

To: David Bremner,


From: Mohsin Kaleem

David Bremner <> writes:

Hi, firstly sorry for taking so long to come back to this. I honestly
have tried to fix this multiple times since my last message but kept
getting confused or misdirected by how the tests are setup so I gave up
and decided to come back to it later. Today I finally just sped through
everything and think I have everything ready.

> So does "python3 -m pytest" work for you? Assuming yes, is there some
> special environment needed? We don't explicitly unset PYTHONPATH in
> T391, so in if you need PYTHONPATH to locate pytest, that should work
> here as well. What output do you get from "python3 -c 'import pytest;
> print(pytest.__file__)'"

I ended up just installing pytest with my system package manager. I have
no idea why but notmuch could not use the pytest installation under my
home directory.

To briefly summarize the changes since my last message:

* I've added notmuch-hello support as well. Basically just added a new
configurable option to `notmuch-saved-searches` for configuring the
exclude value. This involved some mild refactoring of

* Updated the interactive spec of `notmuch-tree` and `notmuch-unthreaded` so
it sources the default value of `notmuch-search-oldest-first` and
`notmuch-search-exclude`. The `notmuch-search` command respected these
variables already but these commands didn't (not sure why).

* I fixed 2 broken test-cases. These were T310-emacs.60 and
T460-emacs-tree.11. The former just didn't include the new option in the
expected argv list. The later was because we now persist the value of
notmuch-search-oldest-first where previously we defaulted it to nil when
switching from a search to tree buffer. The ordering of the messages has
changes so the test failed. I added a new expected-output file with the
new ordering and everything is fixed now.

* I added a new test suite test/ which
contains test cases for the new features. Note this only extends to the
exclude option and it persisting between switches between the different
view types. I initially wanted to keep the existing suites like T310
and add some deleted messages to the corpora but because of the way the
existing tests were setup they could or could not ended up outputting
the deleted messages and having to recalculate the expected-output for
them proved too much of a hassle. The new test suite is designed from
the outset with some deleted and non-deleted messages and covers how
their inclusion in the output changes in a few different scenarios.
Note: this suite isn't fully comprehensive. It doesn't cover any of the
unthreaded commands, or configuring notmuch-hello with entries deviating
from the default. It does cover the core functionality of not showing
excluded mail, toggling the inclusion of such mail and switching between
notmuch-search and notmuch-tree buffers (and vice versa). I've left the
remaining tests as something to come back to later but would prefer
leaving them as something to add in a follow up PR if possible.

Note: Some of the test cases are still failing: Specifically 4 of them,
but their failing on the master branch as well so I believe their
unrelated to this PR.

Mohsin Kaleem
notmuch mailing list --
To unsubscribe send an email to