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 3033B431FBF for ; Tue, 24 Nov 2009 14:10:36 -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 E1nKBnS1gPu7 for ; Tue, 24 Nov 2009 14:10:33 -0800 (PST) Received: from mail-fx0-f214.google.com (mail-fx0-f214.google.com [209.85.220.214]) by olra.theworths.org (Postfix) with ESMTP id A97F1431FAE for ; Tue, 24 Nov 2009 14:10:33 -0800 (PST) Received: by fxm6 with SMTP id 6so7397311fxm.0 for ; Tue, 24 Nov 2009 14:10:32 -0800 (PST) Received: by 10.102.14.4 with SMTP id 4mr3091420mun.2.1259100632770; Tue, 24 Nov 2009 14:10:32 -0800 (PST) Received: from x61s.janakj (r2c34.net.upc.cz [62.245.66.34]) by mx.google.com with ESMTPS id 14sm109259muo.34.2009.11.24.14.10.31 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 24 Nov 2009 14:10:31 -0800 (PST) Received: by x61s.janakj (Postfix, from userid 1000) id 9A4B0440651; Tue, 24 Nov 2009 23:10:30 +0100 (CET) From: Jan Janak To: notmuch@notmuchmail.org Date: Tue, 24 Nov 2009 23:10:26 +0100 Message-Id: <1259100630-13673-1-git-send-email-jan@ryngle.com> X-Mailer: git-send-email 1.6.3.3 Subject: [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: Tue, 24 Nov 2009 22:10:36 -0000 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! -- Jan