unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Mark Walters <markwalters1009@gmail.com>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Subject: Re: notmuch_query_add_tag_excluded and notmuch_query_search_threads
Date: Mon, 08 Dec 2014 17:17:24 +0000	[thread overview]
Message-ID: <87y4qi83iz.fsf@qmul.ac.uk> (raw)
In-Reply-To: <87r3wbe4si.fsf@maritornes.cs.unb.ca>


Hi

>
> At the end of this message is a simpler example, that I think
> demonstrates a bug. At the very list it's not very nice that the
> destructiveness only shows up when excludes are involved.
>
> Here is the output; note the second exclude query!

I think I know what is causing this and can (almost) give a fix.

The problem is that _notmuch_exclude_tags in lib/query.cc is not
idempotent: it iterates through the list of excluded tag attached to
query and changes any which match a tag in the query to "". But this
gets confused if applied a second time as it sees an empty string rather
than Ktag (where "K" is the prefix for 'tag'). 

We could just check in _notmuch_exclude_tags whether the excluded item
is "" and if so, just skip it. (I am not sure what the right syntax for
this in the mix of C and C++ that happens in query.cc)

Alternatively we could try and modify the list of excluded tags directly
when doing the iteration (ie link the previous tag to the next
tag). 

Since both of these do modify the actual query (as we do currently)
there is a possibility that a user could be surprised. I think the user
can't modify the actual query string so I don't think this actually
occurs.

Any thoughts?

Mark



 

      reply	other threads:[~2014-12-08 17:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-06 22:39 notmuch_query_add_tag_excluded and notmuch_query_search_threads Gaute Hope
2014-12-07 11:52 ` David Bremner
2014-12-07 13:24   ` Gaute Hope
2014-12-07 13:54     ` David Bremner
2014-12-07 14:29       ` Gaute Hope
2014-12-07 17:41         ` David Bremner
2014-12-08 17:17           ` Mark Walters [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y4qi83iz.fsf@qmul.ac.uk \
    --to=markwalters1009@gmail.com \
    --cc=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).