[notmuch] [PATCH 0/4] Make tags applied by 'notmuch new' configurable.
authorJan Janak <jan@ryngle.com>
Tue, 24 Nov 2009 22:10:26 +0000 (23:10 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:35:42 +0000 (09:35 -0800)
7b/37e68741913a8d2a051ad59ec5dfbb5e539821 [new file with mode: 0644]

diff --git a/7b/37e68741913a8d2a051ad59ec5dfbb5e539821 b/7b/37e68741913a8d2a051ad59ec5dfbb5e539821
new file mode 100644 (file)
index 0000000..55cd783
--- /dev/null
@@ -0,0 +1,113 @@
+Return-Path: <jan@ryngle.com>\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 3033B431FBF\r
+       for <notmuch@notmuchmail.org>; Tue, 24 Nov 2009 14:10:36 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\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 E1nKBnS1gPu7 for <notmuch@notmuchmail.org>;\r
+       Tue, 24 Nov 2009 14:10:33 -0800 (PST)\r
+Received: from mail-fx0-f214.google.com (mail-fx0-f214.google.com\r
+       [209.85.220.214])\r
+       by olra.theworths.org (Postfix) with ESMTP id A97F1431FAE\r
+       for <notmuch@notmuchmail.org>; Tue, 24 Nov 2009 14:10:33 -0800 (PST)\r
+Received: by fxm6 with SMTP id 6so7397311fxm.0\r
+       for <notmuch@notmuchmail.org>; Tue, 24 Nov 2009 14:10:32 -0800 (PST)\r
+Received: by 10.102.14.4 with SMTP id 4mr3091420mun.2.1259100632770;\r
+       Tue, 24 Nov 2009 14:10:32 -0800 (PST)\r
+Received: from x61s.janakj (r2c34.net.upc.cz [62.245.66.34])\r
+       by mx.google.com with ESMTPS id 14sm109259muo.34.2009.11.24.14.10.31\r
+       (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
+       Tue, 24 Nov 2009 14:10:31 -0800 (PST)\r
+Received: by x61s.janakj (Postfix, from userid 1000)\r
+       id 9A4B0440651; Tue, 24 Nov 2009 23:10:30 +0100 (CET)\r
+From: Jan Janak <jan@ryngle.com>\r
+To: notmuch@notmuchmail.org\r
+Date: Tue, 24 Nov 2009 23:10:26 +0100\r
+Message-Id: <1259100630-13673-1-git-send-email-jan@ryngle.com>\r
+X-Mailer: git-send-email 1.6.3.3\r
+Subject: [notmuch] [PATCH 0/4] Make tags applied by 'notmuch new'\r
+       configurable.\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.12\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, 24 Nov 2009 22:10:36 -0000\r
+\r
+I would like to propose that we make the list of tags applied by 'notmuch new'\r
+configurable. Right now notmuch applies two tags to all new messages added to\r
+the database, 'inbox' and 'unread'. The two tags are added by the C code in\r
+notmuch-new.c and they cannot be changed without editing the source file and\r
+recompiling notmuch.\r
+\r
+The four patches that follow this email allow for configuring the tags to be\r
+added by 'notmuch new' either in the configuration file or on the command\r
+line.\r
+\r
+This change was motivated by my desire to remove both tags from newly added\r
+messages. My rules for adding these two tags are more complex and I do it in\r
+a script run after 'notmuch new'. Instead of 'inbox' and 'unread', I configure\r
+'notmuch new' to add a new tag called 'new' (and only that one). This tag\r
+marks newly added messages that haven't been properly tagged yet by my \r
+auto-tagging scripts. The last script I run after 'notmuch new' removes that\r
+tag. My auto-tagging scripts process only messages with the tag 'new'.\r
+\r
+On a side note; It may seem logical to add/omit the tag 'unread' directly in \r
+'notmuch new' based on the Maildir flags extracted from the filename of the\r
+message. I suggest that we don't do that in 'notmuch new'. A better way would\r
+be writing a small script or command that can be run *after* 'notmuch new'.\r
+We could then distribute it with notmuch (maybe with other small tagging\r
+scripts for common situations). \r
+\r
+I think Maildir flags should be processed after 'notmuch new' is because if\r
+there are multiple copies of a message with different flags, we may need to\r
+see all flags from all filenames to set corresponding tags properly and we may\r
+also need to take the directory part into consideration (i.e. the new mail is\r
+in 'new', not 'cur').\r
+\r
+The list of tags to be applied by notmuch can be configured in the\r
+configuration file. There is a new section [new] which contains configuration\r
+options for 'notmuch new'. There is only one option called 'tags'. The option\r
+contains a semicolon separated list of tags:\r
+\r
+  [new]\r
+  tags=inbox;unread  # Emulate the original behavior\r
+\r
+One of the patches updates 'notmuch setup' to create the section and add\r
+the tags option with tags 'inbox' and 'unread', but only if a new\r
+configuration file is being created. If the configuration file already exists\r
+then it just copies the contents from the old configuration file to the new\r
+one.\r
+\r
+We do not ask the user for the list of tags in the interactive part, that would\r
+have been too much. Users can edit the configuration file manually if they want\r
+to change the list of tags. If they create a new configuration file then they\r
+probably want to accept the default anyway.\r
+\r
+There is one catch for users who already have a configuration file and start\r
+using the patches. They will need to add the new section and the tags option\r
+manually if they want to preserve current behavior of applying 'inbox' and\r
+'unread' automatically by 'notmuch new'.\r
+\r
+The last patch in the set adds a new command line option to 'notmuch new'.\r
+The name of the option is --tag and it can be used to override any tags\r
+configured in the configuration file. For example:\r
+\r
+  notmuch new --tag=outbox --tag=read\r
+\r
+adds the tags 'outbox' and 'read' and ignores any tags from the configuration\r
+file.\r
+\r
+Comments and opinions are welcome!\r
+\r
+   -- Jan\r