Re: [PATCH 6/8] cli: add support for batch tagging operations to "notmuch tag"
authorJani Nikula <jani@nikula.org>
Tue, 3 Apr 2012 08:21:31 +0000 (08:21 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:01 +0000 (09:46 -0800)
06/a6010559a4bb9a0fdb579aa82366daa1df21cf [new file with mode: 0644]

diff --git a/06/a6010559a4bb9a0fdb579aa82366daa1df21cf b/06/a6010559a4bb9a0fdb579aa82366daa1df21cf
new file mode 100644 (file)
index 0000000..937c141
--- /dev/null
@@ -0,0 +1,122 @@
+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 56B77431FB6\r
+       for <notmuch@notmuchmail.org>; Tue,  3 Apr 2012 01:21:37 -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 os68jCbN4LYb for <notmuch@notmuchmail.org>;\r
+       Tue,  3 Apr 2012 01:21:36 -0700 (PDT)\r
+Received: from mail-qa0-f46.google.com (mail-qa0-f46.google.com\r
+       [209.85.216.46]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id A481C431FAE\r
+       for <notmuch@notmuchmail.org>; Tue,  3 Apr 2012 01:21:36 -0700 (PDT)\r
+Received: by qatm19 with SMTP id m19so2470342qat.5\r
+       for <notmuch@notmuchmail.org>; Tue, 03 Apr 2012 01:21:36 -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:cc:subject:in-reply-to:references:user-agent:date\r
+       :message-id:mime-version:content-type:x-gm-message-state;\r
+       bh=v/Od0crtF1prlrbcjpjBYSdger8i6Y0HfSDubwxcIJE=;\r
+       b=BWxkUlMl7hMbOMmNR19m6qF03xOKkAB/IyI0nWnjIsp2t9hIIG5xzn3YcbS/5/34L5\r
+       m1SW5NnwexyoC/ltdIrSLvK71bcXkYimBGXbqxYrDV1g5ckmzfuDnz+D+vYkstWoOKo1\r
+       nQXYFsL4mr+bCiEYSkI5/7kkihTodjLeowb0fYSncP4Y1rkfMC4FHC7wnYbcO2skYh9f\r
+       OWF5aVZK98J842zpMldU9Y5tkSEkTonSzpDNPrsKXnzSAmK/7dxZB8OFJjqI6s/XHd8w\r
+       JWaXiHCq+NbfA8AK/o/m3vEMRieR3moMX52R7vOd1AptAUWNziC3IkEBjB8PUt6Aljk3\r
+       1bKQ==\r
+Received: by 10.224.59.204 with SMTP id m12mr15538060qah.37.1333441295985;\r
+       Tue, 03 Apr 2012 01:21:35 -0700 (PDT)\r
+Received: from localhost (nikula.org. [92.243.24.172])\r
+       by mx.google.com with ESMTPS id w9sm38798041qao.0.2012.04.03.01.21.32\r
+       (version=SSLv3 cipher=OTHER); Tue, 03 Apr 2012 01:21:34 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Jameson Graef Rollins <jrollins@finestructure.net>\r
+Subject: Re: [PATCH 6/8] cli: add support for batch tagging operations to\r
+       "notmuch tag"\r
+In-Reply-To: <87d37p4xor.fsf@servo.finestructure.net>\r
+References: <cover.1333231401.git.jani@nikula.org>\r
+       <f360a40bed50208d146aee8b06946b1b8315e818.1333231401.git.jani@nikula.org>\r
+       <87ty123tpc.fsf@servo.finestructure.net>\r
+       <87aa2tc22z.fsf@zancas.localnet>\r
+       <87iphh50hz.fsf@servo.finestructure.net>\r
+       <CAB+hUn_J9oOmbWaQ+_2yGG6i6ecDXbfJWYbpaYx_kbSnAH+EcA@mail.gmail.com>\r
+       <87fwcl4yr8.fsf@servo.finestructure.net>\r
+       <CAB+hUn-5yB15na2kFMZOjOEujKQTWHiefvgQYsT4Zi3UOzKwQw@mail.gmail.com>\r
+       <87d37p4xor.fsf@servo.finestructure.net>\r
+User-Agent: Notmuch/0.11.1+222~ga47a98c (http://notmuchmail.org) Emacs/23.1.1\r
+       (i686-pc-linux-gnu)\r
+Date: Tue, 03 Apr 2012 08:21:31 +0000\r
+Message-ID: <87pqbpxm2c.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Gm-Message-State:\r
+ ALoCoQmhE6xzmoohG/zbOOuuKWop/TRUyk/GGOYVq+bgf3p5cyLZ005d7Oyo93FLZc6/R9KDvh+4\r
+Cc: Notmuch Mail <notmuch@notmuchmail.org>\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: Tue, 03 Apr 2012 08:21:37 -0000\r
+\r
+On Mon, 02 Apr 2012 14:43:16 -0700, Jameson Graef Rollins <jrollins@finestructure.net> wrote:\r
+> So what if we instead modified the top level binary ("notmuch") to:\r
+> \r
+> * add an option to specify that commands are to be processed from stdin\r
+>   (--batch)\r
+> \r
+> * when in batch mode the db is opened once at the beginning and locked\r
+> \r
+> * commands are processed from stdin in the exact same form they are\r
+>   specified on the command line ("tag +foo -- from:bar", "search\r
+>   tag:foo", etc.).\r
+> \r
+> * db is closed when EOF is reached.\r
+> \r
+> That seems like it would be a generally much cleaner interface, and much\r
+> more flexible.\r
+\r
+Yes, it's more flexible, but what are the real benefits of such\r
+flexibility? What other commands than tag/restore would truly benefit\r
+from this? I might add that nobody has asked for such flexibility.\r
+\r
+As to the cleanliness of the interface, all is well as long as no\r
+characters needing escaping are used. With them, things get hairy. On\r
+the command line, the shell provides the necessary escaping and quoting\r
+mechanisms, and parsing to subcommand argv. I think it would be\r
+confusing to require %NN style hex escaping on the command line where\r
+shell mechanisms can be used, but also it would be a lot of work to\r
+duplicate the shell escaping and quoting mechanisms to the stdin\r
+parsing. For simplicity, I'd use hex escaping for stdin, and leave the\r
+command line to the shell.\r
+\r
+Finally, I'm not sure how the config and database open/close could be\r
+cleanly duplicated in top level "notmuch" and the subcommands. Should\r
+there be logic in the subcommands not to open the config/database if\r
+they're already opened in top level? All of notmuch cli should also be\r
+reworked to pass the config and database on to the subcommands. Not all\r
+the commands need to open the database in read/write mode, and some\r
+commands don't need to open the database at all, so it would not make\r
+sense to move config/database open/close to top level completely.\r
+\r
+In summary, I don't see enough value in this to put all the work\r
+required into it. I think it's way more trouble than it's worth.\r
+\r
+\r
+BR,\r
+Jani.\r