Bug: ol-notmuch.el: calls `notmuch-show' with arbitrary search query

David Edmondson dme at dme.org
Wed Nov 27 12:52:40 PST 2019


On Wednesday, 2019-11-27 at 10:42:59 -07, Sean Whitton wrote:

> On Wed 27 Nov 2019 at 01:08PM +00, David Edmondson wrote:
>
>> On Tuesday, 2019-11-26 at 16:25:29 -07, Sean Whitton wrote:
>>
>>> On Tue 26 Nov 2019 at 10:52PM +00, David Edmondson wrote:
>>>
>>>> The poor behaviour is just a side effect of the way that queries are
>>>> composed to implement the filter functionality. Does the attached patch
>>>> help?
>>>
>>> Unfortunately, it is still broken in my test case.
>>
>> Could you describe your test case please? (We could remove emacs-orgmode
>> for that conversation if you think it appropriate.)
>
> I have this function which calls notmuch-show-filter-thread:
>
>     (defun spw--notmuch-show-filter-thread-patches (&optional reroll-count)
>       (interactive "P")
>       (let ((subject-filter
>              (if reroll-count
>                  (let ((n (prefix-numeric-value reroll-count)))
>                    (if (= n 1)
>                        "(subject:/\\[.*PATCH[^v]*\\]/ or subject:/\\[.*PATCH.*v1.*\\]/)"
>                      (concat "subject:/\\[.*PATCH.*v" (number-to-string n) ".*\\]/")))
>                "subject:/\\[.*PATCH.*\\]/ ")))
>         (notmuch-show-filter-thread
>          (concat "tag:unread or tag:flagged or ("
>                  subject-filter
>                  " and not subject:'Re:' and not subject:'Info received')"))))
>
> Copy-pasting the whole function since you mentioned you were interested
> in the notmuch patch review functionality I'm working on, but let me
> know if you want a narrower test case.

If this does what I think, which is to filter the current thread to show
only those messages that contain actual patches (with an optional
version number), then, with the previous patch I sent, it seems to work
just fine for me if the original `notmuch-show' query is something like
“thread:a or thread:b”, where those threads both contain both patches
and comments on the patches.

An example call I used initially is:

(notmuch-show "thread:{id:20191117222929.1064-1-jb55 at jb55.com} or thread:{id:20190419035659.28961-1-congdanhqx at gmail.com}")

Hopefully this is a query that will work for you as well. Limiting this
using your function behaves as I would expect.

It's a lot to ask, I know, but if you could provide a specific set of
messages with a corresponding initial query that fails for you after
limiting using your function, it would be helpful.

>>> The purpose of `notmuch-extract-thread-patches' is to extract a whole
>>> git-send-email(1) patch series at a time, because that is usually what
>>> one wants to do.  There are `notmuch-extract-message-patches' and
>>> `notmuch-show-pipe-message' for single patches.
>>
>> Then I think the approach that you have (wrapping the query in
>> thread:{}) makes perfect sense.
>
> To my mind, it makes sense only to the extent that committing hacky
> workarounds is something which makes sense :)

Well, if we stick to the idea that the first argument to `notmuch-show'
can only be a thread ID, then yes.

Given that thread IDs have some annoying properties, it would be
convenient to allow the caller to pass an arbitrary query.

If we fix anything that is broken by that, I'm happy to provide a patch
that changes the code (and any implicit or explicit documentation)
accordingly.

dme.
-- 
This is the time. This is the record of the time.


More information about the notmuch mailing list