Re: [PATCH 6/8] cli: add support for batch tagging operations to "notmuch tag"
[notmuch-archives.git] / 96 / e4e3b1d5c5b9b8bf09c081ee9a6244ce7c3c01
diff --git a/96/e4e3b1d5c5b9b8bf09c081ee9a6244ce7c3c01 b/96/e4e3b1d5c5b9b8bf09c081ee9a6244ce7c3c01
new file mode 100644 (file)
index 0000000..e2854e6
--- /dev/null
@@ -0,0 +1,144 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 6B712431FB6\r
+       for <notmuch@notmuchmail.org>; Mon,  2 Apr 2012 12:46:24 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id mroopGnhPzuG for <notmuch@notmuchmail.org>;\r
+       Mon,  2 Apr 2012 12:46:23 -0700 (PDT)\r
+Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
+       [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 3F102431FAE\r
+       for <notmuch@notmuchmail.org>; Mon,  2 Apr 2012 12:46:23 -0700 (PDT)\r
+Received: by bkwj4 with SMTP id j4so2953743bkw.26\r
+       for <notmuch@notmuchmail.org>; Mon, 02 Apr 2012 12:46:20 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=from:to:subject:in-reply-to:references:date:message-id:mime-version\r
+       :content-type:x-gm-message-state;\r
+       bh=AyRYYx2Cgkukv0pWk4nXMeBpndgFXRUVMBBnEcfIzRk=;\r
+       b=Cw6uY2AMSPM0/lrnPMJkxsyAfByxFBNFMDEe30qQI3EGP53ZHXVFXSzzzDjJOBdHBs\r
+       CEJSHu1qplWZ0d9/A1UUMiNbMhDcwbXYtVdVcYe+F8xLSw7eDXKK1z544F2SxcRdxfep\r
+       gwzP2mQFwMlaNAiVeX9cVCg0mYX560lVFuH5YG4dm7kPaVIX658wUogxKJukYBwRzYJQ\r
+       m5lvXwCF96T3lGJVOY+pYjcnzhw0+Y+Y3NGEkYhtkEDuc21SjptAtSLnOzzMa1kq71jk\r
+       1YB/2fKc1e5LEcK5PuKWrnVJXqrkWAtFSR7rU4M32iceiLnx3k5utJ4DnHmvC5s+EcDF\r
+       qluA==\r
+Received: by 10.205.122.77 with SMTP id gf13mr4432300bkc.15.1333395980070;\r
+       Mon, 02 Apr 2012 12:46:20 -0700 (PDT)\r
+Received: from localhost (dsl-hkibrasgw4-fe4fdc00-105.dhcp.inet.fi.\r
+       [80.220.79.105])\r
+       by mx.google.com with ESMTPS id s16sm40849495bkt.3.2012.04.02.12.46.17\r
+       (version=SSLv3 cipher=OTHER); Mon, 02 Apr 2012 12:46:18 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Jameson Graef Rollins <jrollins@finestructure.net>,\r
+ notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 6/8] cli: add support for batch tagging operations to\r
+       "notmuch tag"\r
+In-Reply-To: <87wr5y3ttw.fsf@servo.finestructure.net>\r
+References: <cover.1333231401.git.jani@nikula.org>\r
+       <f360a40bed50208d146aee8b06946b1b8315e818.1333231401.git.jani@nikula.org>\r
+       <87wr5y3ttw.fsf@servo.finestructure.net>User-Agent:\r
+       Notmuch/0.12+81~g839a805 (http://notmuchmail.org) Emacs/23.3.1\r
+       (i686-pc-linux-gnu)\r
+Date: Mon, 02 Apr 2012 22:46:15 +0300\r
+Message-ID: <87bon9apdk.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Gm-Message-State:\r
+ ALoCoQkJ2UAQJhZZJTKxtojgBia6aVhDDp+MNpGS/+SsMlYO56U5nmwTHjFxiGxbXC6JcEdGa3nV\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 02 Apr 2012 19:46:24 -0000\r
+\r
+Jameson Graef Rollins <jrollins@finestructure.net> writes:\r
+\r
+> On Sat, Mar 31 2012, Jani Nikula <jani@nikula.org> wrote:\r
+>> Add support for batch tagging operations through stdin to "notmuch\r
+>> tag". This can be enabled with the new --stdin command line option to\r
+>> "notmuch new". The input must consist of lines of the format:\r
+>>\r
+>> T +<tag>|-<tag> [...] [--] <search-terms>\r
+>\r
+> Hey, Jani.  I can understand why you're going for this form, since it\r
+> mimics the command line arguments for tag and you want to be able to tag\r
+> for arbitrary searches, but I must say that I find it unappealing that\r
+> this functionality is *so* similar to that of notmuch restore, but the\r
+> file format is totally different.  Can't we unify all of this in a\r
+> better way?\r
+\r
+Hi Jameson -\r
+\r
+Thanks for your comments. The intent is to converge notmuch tag and\r
+restore file formats, and reuse the code between them. The above is the\r
+proposed format for both, but I see that I failed to mention the future\r
+plans.\r
+\r
+This actually started from David's dump/restore rework [1]. I wanted to\r
+have batch tagging, and realized his proposed format wouldn't work for\r
+that. There was some discussion about this on IRC, and we settled on the\r
+above format as a starting point. And now would be the time to comment\r
+on the format, if you have any issues with it! ;)\r
+\r
+> This patch series seems to beg that we actually just unify the tag and\r
+> restore functions in to one thing.  They're really just doing the same\r
+> thing.  If we extended restore to accept a search-term instead of a\r
+> message id they would in fact be identical.\r
+>\r
+> The more I think about it the more it makes sense to me that we just\r
+> merge tag and restore, and extend the input file format to be able to\r
+> accept search terms.  It just doesn't make sense to have these two\r
+> interfaces that do basically the exact same thing but in a slightly\r
+> divergent way.\r
+\r
+I totally agree on this goal. The dump/restore follow-up part is a\r
+work-in-progress in my local tree. At least initially, the format would\r
+be the same for tag and restore, but with the following subtle\r
+differences:\r
+\r
+1) notmuch restore will only accept an id:message-id style query to be\r
+   able to warn about messages present in the dump file but missing in\r
+   the database. This is because dump/restore is primarily a\r
+   backup/restore style operation.\r
+\r
+2) Partly because of the above, and partly because of notmuch restore\r
+   --accumulate vs. not, the query/tagging optimizations will have to be\r
+   different.\r
+\r
+The rough idea is that both notmuch tag and restore would use the same\r
+file parsing (tag_file() introduced in this series), but notmuch tag\r
+would use tag_query() in notmuch-tag.c for tagging, and notmuch restore\r
+would use tag_message() in notmuch-restore.c for tagging.\r
+\r
+> and btw, according to comments in the code 'T' is supposed to stand for\r
+> the action, "tag" in this case.  What other actions do you imagine?\r
+\r
+This was actually David's idea. It allows extensibility in the format.\r
+\r
+Thanks again for your interest, and sorry about not opening up the\r
+future plans up front.\r
+\r
+\r
+BR,\r
+Jani.\r
+\r
+\r
+[1] id:"1324214111-32079-1-git-send-email-david@tethera.net"\r