Re: [PATCH 2/2] added support for user-specified directories to exclude

Subject:Re: [PATCH 2/2] added support for user-specified directories to exclude

Date:Fri, 27 Jan 2012 17:14:04 -0500

To:Tomi Ollila

Cc:notmuch@notmuchmail.org

From:Austin Clements


Quoth Tomi Ollila on Jan 27 at 12:41 pm:
> On Thu, 26 Jan 2012 13:11:36 +0000, Jani Nikula <jani@nikula.org> wrote:
> > On Thu, 26 Jan 2012 12:11:58 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> > > A new configuration key 'database.exclude' is used to determine
> > > which directories user wants not to be scanned for new mails.
> > > 
> > > ---
> > > 
> > > Notes (from 2011-09-13):
> > > 
> > > 1) Currently the comments for newly created configuration file are not
> > > updated, so for not this is 'undocumented feature'. Should there be an
> > > empty configuration line as a placeholder ... ?
> > > 
> > > 2) Whenever some already existing directory is added to the exclude list
> > > and the parent directory timestamp has not changed, notmuch new will not
> > > notice the directory has gone (as it still is there), user needs to 'touch'
> > > the parent directory before next 'notmuch new' no make notmuch notice.
> > > 
> > > 2012-01-26: could notmuch track mtime of the configuration file and if
> > > that changes, ignore mail directory timestamps ?
> > > 
> > > 3) count_files() function is not touched. The functionality there has fallen
> > > behind of add_files_recursive (maildir+tmp check and following symlinks).
> > > The question there should it be updated, or attempted to merge with
> > > add_files (as the comment says). count_files() is only called at the beginning
> > > when database is not yet initialised.
> > > ---
> 
> [ ... ]
> 
> > > +	/* Ignore user-specified directories */
> > > +	for (j = 0; j < state->database_exclude_length; j++)
> > > +	    if (strcmp(entry->d_name, state->database_exclude[j]) == 0)
> > > +		break;
> > > +	if (j < state->database_exclude_length)
> > > +	    continue;
> > 
> > How about wrapping that in a function you can use here and below?
> > 
> > 	if (user_wants_this_excluded (...))
> > 		continue;
> 
> Good point....
> 
> > Please also have a look at id:"87pqecylon.fsf@nikula.org" and the
> > patches Austin posted. "Auto ignore"?
> 
> I personally don't mind auto ignore -- I even like the system yells about
> those 3 files I forgot to add to ignore list every now and then (when the
> mtime of the directory those are located changes). This is also something
> different -- I can start keeping my drafts and spam directories alongside
> other mail directories (or folders is you want to use that term).

The allure of auto ignore is that you don't have to do anything to use
it, but it's much less powerful than explicit ignores.  I think having
both mechanisms would be overkill and I would use explicit ignores in
preference to auto ignore.

> Thanks for that id: it refers thread starting from id:"ylp7hi23mw8.fsf@tyndall.ie" 
> ( http://notmuchmail.org/pipermail/notmuch/2010/003145.html )
> 
> and the patch there is somewhat more complete (although old rebase-wise). 
> It's easy to combine works together, but more difficult is to choose best 
> terminology: database.exclude vs. new.ignore (or something in between or 
> totally different). Ideas anyone?

I would weigh in on the side of new.ignore, or at least something
under [new].  This option fits better with the existing option in
[new] than it does with the existing option in [database].

Thread: