unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 0/4] Make tags applied by 'notmuch new' configurable.
@ 2009-11-24 22:10 Jan Janak
  2009-11-24 22:10 ` [PATCH 1/4] notmuch-new: Remove tag_add_inbox_unread in favor of a generic solution Jan Janak
                   ` (6 more replies)
  0 siblings, 7 replies; 25+ messages in thread
From: Jan Janak @ 2009-11-24 22:10 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2009-12-04  6:18 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-24 22:10 [PATCH 0/4] Make tags applied by 'notmuch new' configurable Jan Janak
2009-11-24 22:10 ` [PATCH 1/4] notmuch-new: Remove tag_add_inbox_unread in favor of a generic solution Jan Janak
2009-11-24 22:10   ` [PATCH 2/4] notmuch: Config option to specify tags to be applied by 'notmuch new' Jan Janak
2009-11-24 22:10     ` [PATCH 3/4] notmuch-setup: Copy/create the new section with tags for 'notmuch-new' Jan Janak
2009-11-24 22:10       ` [PATCH 4/4] notmuch-new: New cmdline option --tag=<name> Jan Janak
2009-11-25  6:21         ` Karl Wiberg
2009-11-25 17:59           ` Jan Janak
2009-11-25 18:37         ` [PATCH] notmuch-new: Option to disable tags from the configuration file Jan Janak
2009-11-25 19:55           ` Bart Trojanowski
2009-11-25 21:25             ` Jan Janak
2009-11-25 20:56     ` [PATCH 2/4] notmuch: Config option to specify tags to be applied by 'notmuch new' Bart Trojanowski
2009-11-25 21:50       ` Jan Janak
2009-12-02 21:42         ` Carl Worth
2009-11-24 22:50 ` [PATCH 0/4] Make tags applied by 'notmuch new' configurable Brett Viren
2009-11-25  3:07 ` Bdale Garbee
2009-11-25  3:35 ` Bart Trojanowski
2009-11-25 23:30 ` [PATCH 1/5] notmuch-new: Remove tag_add_inbox_unread in favor of a generic solution Jan Janak
2009-11-25 23:30   ` [PATCH 2/5] notmuch: Config option to specify tags to be applied by 'notmuch new' Jan Janak
2009-11-25 23:30     ` [PATCH 3/5] notmuch-setup: Copy/create the new section with tags for 'notmuch-new' Jan Janak
2009-11-25 23:30       ` [PATCH 4/5] notmuch-new: New cmdline option --tag=<name> Jan Janak
2009-11-25 23:30         ` [PATCH 5/5] notmuch-new: Option to disable tags from the configuration file Jan Janak
2009-11-25 23:48 ` [PATCH 0/4] Make tags applied by 'notmuch new' configurable Jan Janak
2009-12-02 21:36 ` Carl Worth
2009-12-03  9:48   ` Marten Veldthuis
2009-12-04  6:17     ` Carl Worth

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).