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 906C1431FAF for ; Sat, 24 Nov 2012 05:21:03 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 2.7 X-Spam-Level: ** X-Spam-Status: No, score=2.7 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, FREEMAIL_REPLY=2.499, 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 ggEG39vUGR-b for ; Sat, 24 Nov 2012 05:21:03 -0800 (PST) Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id E7471431FAE for ; Sat, 24 Nov 2012 05:21:02 -0800 (PST) Received: by mail-wi0-f175.google.com with SMTP id hm11so1793227wib.2 for ; Sat, 24 Nov 2012 05:21:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=86OJ6ItwwSjti3twsXRw+ydILRsUSjRmZO8Ea29Gl+w=; b=hgP+hD5i+Irb6HCRNQzIkytnUg5b8iKPfBarhg0SlLhabWCUyf/28FStnhXyUtsTHH +BrgzKtDtZjwWaB7BepkOkpV0tAFq7knYR0KQcih1AcmR/bWwmo9L/IUlYhvWbmUxGp1 EN4KVI8RIkQeFNQJ9aConIozwraHTMB2MxSCPpvyXsupx/XRE+y8wO+vS2mVGA8nt73M QdkbUyGnSlaBc47AQt39bMQJl1OeLM6WT4Q6GkbO28WaBxVyT3RvhG0I0VMdXU1h0mps ZLSFpu4xKToRFhSEU8MCElv9WTBISZDakuYAFbXFPqAj6C7XClE9CzGo9FhPdXbIQstQ hhTQ== Received: by 10.180.14.162 with SMTP id q2mr13659794wic.21.1353763260361; Sat, 24 Nov 2012 05:21:00 -0800 (PST) Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) by mx.google.com with ESMTPS id i2sm12682341wiw.3.2012.11.24.05.20.58 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 24 Nov 2012 05:20:59 -0800 (PST) From: markwalters1009 To: notmuch@notmuchmail.org Subject: [PATCH v2 0/7] Fix emacs tagging race Date: Sat, 24 Nov 2012 13:20:49 +0000 Message-Id: <1353763256-32336-1-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 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: Sat, 24 Nov 2012 13:21:03 -0000 This is version 2 of this series: version 1 is at id:1352487491-31512-1-git-send-email-markwalters1009@gmail.com but this is a much more complete version. Version 1 roughly corresponds to patches 5-7. The first two patches allows queries to come from stdin (if the query string is "-"). This is necessary to avoid ARGMAX limits in some cases. They are independent of the rest of the series. The main thing needed for these two (apart from review!) is a manpage but I wasn't sure whether that should go in notmuch-search-terms or somewhere else. Patches 3 and 4 make the emacs interface use this new functionality to pass the tagging query. These two patches depend on the previous two but are independent of the later patches. Note that it is possible (if unlikely) to trigger the ARGMAX problem in current notmuch: highlight most or all of a large search buffer and then try to tag the region. Patches 5-7 actually fix the race. They do this by appending two query strings to each search: one query string for the matching messages and one for the non-matching messages. The front-end can then combine these query strings to make sure it only tags messages that were present/matched when the search buffer was created. The main changes from v1 are to append query-string rather than all the message-ids (so if we had a better way of constructing the queries we could switch to that later) and to use Austin's suggestion of --queries=true to add the queries. I think we do want the choice as appending the string could easily double the size of the output. This version (since rebasing and tidying) is not heavily tested (all tests pass) but I have been running a similar version for some time without problems. Best wishes Mark Mark Walters (7): cli: allow query to come from stdin test: for the new query from stdin functionality emacs: notmuch.el split call-process into call-process-region emacs: make emacs tagging use the stdin query functionality test: test for race when tagging from emacs search cli: allow search mode to include msg-ids with JSON output emacs: make emacs use message-ids for tagging emacs/notmuch-tag.el | 14 +++++--- emacs/notmuch.el | 47 ++++++++++++++++++++---- notmuch-search.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++--- query-string.c | 41 +++++++++++++++++++++ test/emacs | 21 +++++++++++ test/tagging | 9 +++++ 6 files changed, 208 insertions(+), 19 deletions(-) -- 1.7.9.1