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 701E9431FB6 for ; Tue, 15 May 2012 06:22:45 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[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 IRmS+LBF4hlc for ; Tue, 15 May 2012 06:22:43 -0700 (PDT) Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU [18.9.25.12]) by olra.theworths.org (Postfix) with ESMTP id A3B37431FAE for ; Tue, 15 May 2012 06:22:43 -0700 (PDT) X-AuditID: 1209190c-b7fad6d000000920-e1-4fb258a216ab Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP id 40.13.02336.2A852BF4; Tue, 15 May 2012 09:22:42 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q4FDMfHf027957; Tue, 15 May 2012 09:22:41 -0400 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q4FDMdXL029979 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Tue, 15 May 2012 09:22:40 -0400 (EDT) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1SUHi3-0003J3-0g; Tue, 15 May 2012 09:22:39 -0400 Date: Tue, 15 May 2012 09:22:38 -0400 From: Austin Clements To: Robert Horn Subject: Re: Using procmail to set tags Message-ID: <20120515132238.GO11804@mit.edu> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOIsWRmVeSWpSXmKPExsUixG6nrrsoYpO/wYFlwhbXb85kdmD0eLbq FnMAYxSXTUpqTmZZapG+XQJXRue0mSwFjwQqnjxexd7AuJe3i5GTQ0LAROLl1iXMELaYxIV7 69lAbCGBfYwS9/erdjFyAdkbGCUmLj3JDpE4ySRxYB8LRGIJo8TpjWfBulkEVCVmPd3NAmKz CWhIbNu/nBHEFgGKT5g5ixXEZhaQlvj2u5kJxBYWUJdY3/kLbCivgI7E1xVbgeIcQEN1JRYu UIYIC0qcnPmEBaJVS+LGv5dgJSBjlv/jAAlzCuhJnG/aADZFVEBFYsrJbWwTGIVmIemehaR7 FkL3AkbmVYyyKblVurmJmTnFqcm6xcmJeXmpRbqGermZJXqpKaWbGEHhyynJs4PxzUGlQ4wC HIxKPLxO6zf6C7EmlhVX5h5ilORgUhLljQjb5C/El5SfUpmRWJwRX1Sak1p8iFGCg1lJhFfM DCjHm5JYWZValA+TkuZgURLnVdF65yckkJ5YkpqdmlqQWgSTleHgUJLg7Q4HahQsSk1PrUjL zClBSDNxcIIM5wEabg9Sw1tckJhbnJkOkT/FqCglzpsPkhAASWSU5sH1wtLLK0ZxoFeEeatB qniAqQmu+xXQYCagwY0sYINLEhFSUg2MLOIWqjMtq+yLWyboxKwMLP61he/k35T0hh0t2j+N Ls0rDZGOm+jMa2EUvOq3oJ3/gf8Li2Z6CusWuO9/LL7k0tftvlGpzmFvlTbqzt52iuO+35V7 h9jtA9WskrV+HV8nmudRtYBTPs6ZKb1FSdXC4P+NyctWpqy11vtmVLpV/v/FBQstH2xRYinO SDTUYi4qTgQAVBK9wgoDAAA= Cc: notmuch@notmuchmail.org 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: Tue, 15 May 2012 13:22:45 -0000 Quoth Robert Horn on May 14 at 7:34 pm: > Is it practical (and has anyone documented) using a procmail setup to > set initial tags for messages using notmuch? > > I've just started using emacs-notmuch to read mail, and I'm using a > system where I have procmail filters to bin mail by category into > folders. I can continue this using folder:value for searching, but one > reason notmuch interests me is the potential to do more. > > It's practical for me to assign potentially overlapping tags with a more > sophisticated procmail setup. Notmuch tags enable having multiple tags > on one email. > > I don't know enough about the procmail/notmuch process to see just how > to make this happen. I'm hoping that someone has already done something > similar. I second Jani's suggestion of using notmuch tag commands from notmuch's post-new hook if possible (or switching to using searches instead of tags where that makes sense). However, if you really need the flexibility of procmail, I can think of two solutions: You can let procmail deliver to folders, like usual, and then use notmuch tag tag:inbox folder:X +/-tags in notmuch's post-new hook to apply tags based on folders (you might want to add the tag 'new' to your new.tags in ~/.notmuch-config and filter on tag:new instead of tag:inbox). If you need multiple tags on a message, let procmail deliver it to multiple folders. Alternatively, you can have procmail record the message ID and desired tags of the message in a file and then apply those recorded tags in your post-new hook. This would achieve the tagging you want more directly, without mixing in folders and multiple delivery. The difficulty would be getting a message ID you could later use in an id: query. Simply grabbing the value of the message-id header would work most of the time, but there's a fair bit of logic for dealing with strangely formed or completely malformed message-id headers (see _parse_message_id). As far as I know, nobody has tried my second suggestion. Most people just switch to using notmuch queries (either to tag or simply to search).