From f5a676acb125ae00dc458b8a69d0e7b950d98b72 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Wed, 15 Feb 2012 09:03:28 +0000 Subject: [PATCH] [RFC PATCH v5 00/11] Add NOTMUCH_MESSAGE_FLAG_EXCLUDED flag --- dd/2fbbc09a4d67168f420410686c9d52e0267d6a | 162 ++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 dd/2fbbc09a4d67168f420410686c9d52e0267d6a diff --git a/dd/2fbbc09a4d67168f420410686c9d52e0267d6a b/dd/2fbbc09a4d67168f420410686c9d52e0267d6a new file mode 100644 index 000000000..e8a1f24b5 --- /dev/null +++ b/dd/2fbbc09a4d67168f420410686c9d52e0267d6a @@ -0,0 +1,162 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id F366A431E62 + for ; Wed, 15 Feb 2012 01:02:54 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, + RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id OE6iGE1nwG3h for ; + Wed, 15 Feb 2012 01:02:52 -0800 (PST) +Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com + [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + 89F02431FBD for ; Wed, 15 Feb 2012 01:02:52 -0800 + (PST) +Received: by wgbdt12 with SMTP id dt12so647956wgb.2 + for ; Wed, 15 Feb 2012 01:02:51 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; + h=from:to:cc:subject:date:message-id:x-mailer; + bh=xfWa4iSfYeIcjj54sgfNbQwlGO+eZFCPcU7+0dVNWD0=; + b=kU5Yh3GfY3sHgGT1uUtmb4bYEtpsmE1/FwMQnaj4XVd5nnnM7O2jXUlve1uujDt0zf + yk7W0Kr+B6vXalkSjLXtR3KN6YiTnpzqyEoeN+zN0Yba8hN3dAkkzRLMdn0NUY/q/3Ho + kbiowFq4m2ofEKvbWPWZhwGlu0amuEiTbKHRo= +Received: by 10.216.133.91 with SMTP id p69mr9154635wei.30.1329296571188; + Wed, 15 Feb 2012 01:02:51 -0800 (PST) +Received: from localhost (94-192-233-223.zone6.bethere.co.uk. + [94.192.233.223]) by mx.google.com with ESMTPS id + da8sm32094410wib.6.2012.02.15.01.02.48 (version=TLSv1/SSLv3 cipher=OTHER); + Wed, 15 Feb 2012 01:02:49 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [RFC PATCH v5 00/11] Add NOTMUCH_MESSAGE_FLAG_EXCLUDED flag +Date: Wed, 15 Feb 2012 09:03:28 +0000 +Message-Id: <1329296619-7463-1-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.2.3 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 15 Feb 2012 09:02:55 -0000 + +This is v5 of the exclude flag series. (v4 was at +id:"874nv9rv79.fsf@qmul.ac.uk") + +This email has 4 sections, an overview of what the patch set is +trying to achieve, a summary of the changes from v4, some comments on +the status of the patches in the series and some remaining queries. + +OVERVIEW + +The current implementation of exclude-tags does not use excludes in +notmuch-show.c (and thus not in notmuch-show.el). Thus when selecting +a thread in the search view claiming one matched message you may get +several matches in show all but one of which are tagged excluded. + +The trivial change of adding excludes to show does not work as easily +as one would like. For example if you try notmuch-show +id: you get no results (see +id:"871uqvgrnm.fsf@qmul.ac.uk" for more discussion). + +This set moves in a different direction. It returns all the results +but marks excluded messages with a new flag +(NOTMUCH_MESSAGE_FLAG_EXCLUDED) and lets the consumer decide what to +do with them. For example it could start with the message closed in +emacs show view, it could colour the headerline differently etc. + +CHANGES: +This has been rebased on top of Jani's notmuch-show command line +parsing patch. + +The function notmuch_thread_get_flag_messages function added in v4 +has been removed. Unfortunately (as Austin pointed out) that patch +broke binary compatibility so should be deferred until we wish to +bump the library version. + +I also fixed a minor bug and a style comment in the emacs part of +the patch. + +STATUS: +The first 3 patches in the series just add a --no-exclude option +to notmuch-search.c and notmuch-count.c to "turn off" the excluding. +(The 3 patches are one for the C code, one for the man pages and +one for the tests.) I think this change is desirable independently +of the rest of the series (and indeed Jameson had a use for it +id:"878vk943ci.fsf@servo.finestructure.net"). + +QUERIES + +1) As with v4 the api notmuch_query_set_omit_excluded_messages +remains: without it I can't see how a user can pass a +notmuch_messages_t object around which does not contain the +excluded messages. See id:"87fweusabh.fsf@qmul.ac.uk". + +2) If we have a query which overrides the excludes such as "blah and +tag:deleted" should the tag:deleted messages still be marked excluded? +The current implementation does mark them excluded but my preference +would be not to. What do people think? At the moment 2 tests fail but +the correct output depends on the above so I will leave them until we +have a decision on this. + +There are some other queries mentioned in v4 but the two above are +the significant ones. + +Best wishes + +Mark + + + +Mark Walters (11): + cli: add --no-exclude option to count and search. + cli: Add --no-exclude to the man pages for search and count + test: add tests for new cli --no-exclude option + lib: Rearrange the exclude code in query.cc + lib: Make notmuch_query_search_messages set the exclude flag + lib: Add the exclude flag to notmuch_query_search_threads + cli: Make notmuch-show respect excludes. + man: update manpage for notmuch-show --no-exclude option + test: update tests to reflect the exclude flag + cli: omit excluded messages in results where appropriate. + emacs: show: recognize the exclude flag. + + emacs/notmuch-show.el | 19 +++++++++++- + lib/notmuch-private.h | 8 ++++- + lib/notmuch.h | 16 ++++++++-- + lib/query.cc | 74 ++++++++++++++++++++++++++++++++++++++------ + lib/thread.cc | 18 +++++++++-- + man/man1/notmuch-count.1 | 7 ++++ + man/man1/notmuch-search.1 | 7 ++++ + man/man1/notmuch-show.1 | 7 ++++ + notmuch-count.c | 19 ++++++++---- + notmuch-search.c | 26 ++++++++++++---- + notmuch-show.c | 31 ++++++++++++++++-- + test/count | 21 +++++++++++++ + test/crypto | 9 +++++- + test/encoding | 2 +- + test/json | 6 ++-- + test/maildir-sync | 1 + + test/multipart | 4 +- + test/search | 5 +++ + test/thread-naming | 16 +++++----- + 19 files changed, 246 insertions(+), 50 deletions(-) + +-- +1.7.2.3 + -- 2.26.2