Re: [PATCH 0/6] Sort by from and subject

Subject: Re: [PATCH 0/6] Sort by from and subject

Date: Sat, 30 Sep 2017 17:03:02 +0100

To: Jani Nikula, William Casarin,


From: Mark Walters


On Sat, 30 Sep 2017, Jani Nikula <> wrote:
> On Sat, 30 Sep 2017, William Casarin <> wrote:
>> Jani Nikula <> writes:
>>> I think there are two considerations here:
>>> First, is this something we want to have? Is this generally useful?
>> Sorting by from and subject are in most mail clients (mutt, gnus, outlook...)
> Which of those display results as threads, and of those that do, how do
> they sort the threads? In the notmuch case, the threads would be sorted
> based on one of the matching messages. Which one should it be? For
> current date based searches, the message used for sorting is also
> selected based on date.

I agree with Jani that for thread based views sorting by from is a
little odd -- sorting by subject less so as that is mostly constant in a

But allowing sorting by from in message based views could be useful. If
we are looking at the notmuch-emacs frontend then that would be in tree
view. This calls notmuch-show.c from the CLI, so that is the place I
would suggest we do this. If notmuch-show.c returns each message as "if
it were in its own thread" in the sense of the sexp output (see
devel/schemata) I think notmuch-tree would just work.

>>> There's still the issue of From: and Subject: needing more heuristic for
>>> useful sorting that I mentioned in
>> I think I understand what you mean in but I
>> don't have enough knowledge of notmuch to implement what you're asking
>> :(. I believe these are rare cases because I haven't ran into the issue
>> you described?
> Look at the subject line of this message. Should it be sorted starting
> at "Re:", "[PATCH", or "Sort"? You could argue for and against any one
> of them. Contrast that with the thread sorting above: If the matching
> message in this thread changes from one with vs. without "Re:", the sort
> placement of the thread could change considerably.
> It's common for some corporate mail systems to switch "Firstname
> Lastname" in messages to "Lastname, Firstname". Should we do something
> about that?
> Arguably we could do the sorting first, and think of ways to improve it
> afterwards.

These are concerns, but I agree that we try some form of sorting first
and then think about improving it. I think the above as an interface to
notmuch-tree should work -- I had something similar in the very early
days of notmuch-tree (when it was notmuch-pick) but dropped it when
trying to keep the patch set small enough to be even vaguely manageable.

Best wishes


notmuch mailing list