Re: Using procmail to set tags
authorTomi Ollila <tomi.ollila@iki.fi>
Tue, 15 May 2012 13:43:31 +0000 (16:43 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:47:06 +0000 (09:47 -0800)
e5/4de6c44f80bb7e818358125e132f6411e1a363 [new file with mode: 0644]

diff --git a/e5/4de6c44f80bb7e818358125e132f6411e1a363 b/e5/4de6c44f80bb7e818358125e132f6411e1a363
new file mode 100644 (file)
index 0000000..a797af2
--- /dev/null
@@ -0,0 +1,86 @@
+Return-Path: <tomi.ollila@iki.fi>\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 25D39431FB6\r
+       for <notmuch@notmuchmail.org>; Tue, 15 May 2012 06:49:09 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       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 GoVfa+jf8U8O for <notmuch@notmuchmail.org>;\r
+       Tue, 15 May 2012 06:49:08 -0700 (PDT)\r
+X-Greylist: delayed 345 seconds by postgrey-1.32 at olra;\r
+       Tue, 15 May 2012 06:49:07 PDT\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id DB62D431FAE\r
+       for <notmuch@notmuchmail.org>; Tue, 15 May 2012 06:49:07 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+       id AB0BD10063A; Tue, 15 May 2012 16:43:31 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Austin Clements <amdragon@MIT.EDU>, Robert Horn <rjhorn@alum.mit.edu>\r
+Subject: Re: Using procmail to set tags\r
+In-Reply-To: <20120515132238.GO11804@mit.edu>\r
+References: <m3vcjyl4kg.fsf@quad.robs.office> <20120515132238.GO11804@mit.edu>\r
+User-Agent: Notmuch/0.13~rc1+22~g672e3f0 (http://notmuchmail.org) Emacs/23.1.1\r
+       (x86_64-redhat-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+       $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+       !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Tue, 15 May 2012 16:43:31 +0300\r
+Message-ID: <m21umllfuk.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Cc: 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, 15 May 2012 13:49:09 -0000\r
+\r
+On Tue, May 15 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
+\r
+>\r
+> Alternatively, you can have procmail record the message ID and desired\r
+> tags of the message in a file and then apply those recorded tags in\r
+> your post-new hook.  This would achieve the tagging you want more\r
+> directly, without mixing in folders and multiple delivery.  The\r
+> difficulty would be getting a message ID you could later use in an id:\r
+> query.  Simply grabbing the value of the message-id header would work\r
+> most of the time, but there's a fair bit of logic for dealing with\r
+> strangely formed or completely malformed message-id headers\r
+> (see _parse_message_id).\r
+\r
+If procmail is delivering one mail at a time (without parallerism) and\r
+notmuch new is executed after each email delivered one could try\r
+\r
+  * put desired tags into environment (export NEW_TAGS='+foo +bar')\r
+  * execute notmuch new\r
+  * use the environment variables in post-new hook \r
+      (notmuch tags $NEW_TAGS -new tag:new)\r
+\r
+The risk with this approach (when not recording message-id) is that there\r
+ie not just one new mail (with 'new' tag) delivered...\r
+\r
+Then I sidedtacked to... wouldn't something like\r
+         notmuch new +<tags> -<tags> [path/to/filename]\r
+be so cool... ;) (yes, so non-trivial...)\r
+\r
+>\r
+> As far as I know, nobody has tried my second suggestion.  Most people\r
+> just switch to using notmuch queries (either to tag or simply to\r
+> search).\r
+\r
+Tomi\r