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 6BE6B431FBC for ; Wed, 25 Nov 2009 15:48:27 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org 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 D4+BtfR8g-2q for ; Wed, 25 Nov 2009 15:48:26 -0800 (PST) Received: from mail-ew0-f213.google.com (mail-ew0-f213.google.com [209.85.219.213]) by olra.theworths.org (Postfix) with ESMTP id 6070E431FAE for ; Wed, 25 Nov 2009 15:48:26 -0800 (PST) Received: by ewy5 with SMTP id 5so269346ewy.30 for ; Wed, 25 Nov 2009 15:48:25 -0800 (PST) Received: by 10.213.0.135 with SMTP id 7mr7420766ebb.64.1259192905411; Wed, 25 Nov 2009 15:48:25 -0800 (PST) Received: from x61s.janakj ([213.192.30.141]) by mx.google.com with ESMTPS id 10sm347473eyz.15.2009.11.25.15.48.23 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 25 Nov 2009 15:48:24 -0800 (PST) Received: by x61s.janakj (Postfix, from userid 1000) id 78DA5440655; Thu, 26 Nov 2009 00:48:22 +0100 (CET) Date: Thu, 26 Nov 2009 00:48:22 +0100 From: Jan Janak To: notmuch@notmuchmail.org Message-ID: <20091125234822.GH25119@ryngle.com> References: <1259100630-13673-1-git-send-email-jan@ryngle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1259100630-13673-1-git-send-email-jan@ryngle.com> User-Agent: Mutt/1.5.18 (2008-05-17) Subject: Re: [notmuch] [PATCH 0/4] Make tags applied by 'notmuch new' configurable. X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.12 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: Wed, 25 Nov 2009 23:48:27 -0000 Hello, On 24-11 23:10, Jan Janak wrote: > I would like to propose that we make the list of tags applied by 'notmuch new' > configurable. Right now notmuch applies two tags to all new messages added to > the database, 'inbox' and 'unread'. The two tags are added by the C code in > notmuch-new.c and they cannot be changed without editing the source file and > recompiling notmuch. > > The four patches that follow this email allow for configuring the tags to be > added by 'notmuch new' either in the configuration file or on the command > line. > > This change was motivated by my desire to remove both tags from newly added > messages. My rules for adding these two tags are more complex and I do it in > a script run after 'notmuch new'. Instead of 'inbox' and 'unread', I configure > 'notmuch new' to add a new tag called 'new' (and only that one). This tag > marks newly added messages that haven't been properly tagged yet by my > auto-tagging scripts. The last script I run after 'notmuch new' removes that > tag. My auto-tagging scripts process only messages with the tag 'new'. > > On a side note; It may seem logical to add/omit the tag 'unread' directly in > 'notmuch new' based on the Maildir flags extracted from the filename of the > message. I suggest that we don't do that in 'notmuch new'. A better way would > be writing a small script or command that can be run *after* 'notmuch new'. > We could then distribute it with notmuch (maybe with other small tagging > scripts for common situations). > > I think Maildir flags should be processed after 'notmuch new' is because if > there are multiple copies of a message with different flags, we may need to > see all flags from all filenames to set corresponding tags properly and we may > also need to take the directory part into consideration (i.e. the new mail is > in 'new', not 'cur'). > > The list of tags to be applied by notmuch can be configured in the > configuration file. There is a new section [new] which contains configuration > options for 'notmuch new'. There is only one option called 'tags'. The option > contains a semicolon separated list of tags: > > [new] > tags=inbox;unread # Emulate the original behavior > > One of the patches updates 'notmuch setup' to create the section and add > the tags option with tags 'inbox' and 'unread', but only if a new > configuration file is being created. If the configuration file already exists > then it just copies the contents from the old configuration file to the new > one. > > We do not ask the user for the list of tags in the interactive part, that would > have been too much. Users can edit the configuration file manually if they want > to change the list of tags. If they create a new configuration file then they > probably want to accept the default anyway. > > There is one catch for users who already have a configuration file and start > using the patches. They will need to add the new section and the tags option > manually if they want to preserve current behavior of applying 'inbox' and > 'unread' automatically by 'notmuch new'. > > The last patch in the set adds a new command line option to 'notmuch new'. > The name of the option is --tag and it can be used to override any tags > configured in the configuration file. For example: > > notmuch new --tag=outbox --tag=read > > adds the tags 'outbox' and 'read' and ignores any tags from the configuration > file. > > Comments and opinions are welcome! I updated this patch series, adding features and bug fixes suggested by others on the list. The command line option --tag now *adds* tags, so the tags configured in the configuration file are still applied...unless you use the new option --no-config-tag. With this option only the tags specified on the command line will be applied by 'notmuch-new'. -- Jan