[PATCH] notmuch new: add a --in-directory option

Tomi Ollila tomi.ollila at iki.fi
Fri Mar 7 03:53:44 PST 2014


On Thu, Mar 06 2014, Adam Wolfe Gordon <awg+notmuch at xvx.ca> wrote:

> On Thu, Mar 6, 2014 at 2:06 PM, Austin Clements <amdragon at mit.edu> wrote:
>> That aside, I'm curious what the use case for this is.

I am also interested... How are mails delivered so that
--in-directory=folder is useful

>
> My usecase for this is the same as for the similar patch I worked on
> previously (id:1373762746-22308-1-git-send-email-awg+notmuch at xvx.ca):

... as this is (much more) interesting to me too ...


> I use inotify to watch for new messages in my maildir. When I receive
> a new message, I run notmuch new (after waiting a couple of seconds
> since messages sometimes arrive in batches). But since I already know
> exactly what changed, there's no need for notmuch new to scan the
> whole directory tree. I'm not sure whether this patch lets me specify
> a file, or only a directory: the former would be preferable for my
> usecase, but either way it's probably an enhancement for me.

my mails are delivered by
https://github.com/domo141/nottoomuch/blob/master/md5mda.sh
to ~/mail/received/??/??????????????????????????????
and log to the deliveries are kept:

$ echo; tail -5 mail/log/md5mda-201403.log

2014-03-07 (Fri) 11:58:37: Added 'received/a8/5bb1949aa85bb84287499555dabb00'
2014-03-07 (Fri) 12:33:57: Added 'received/34/b786dabccc980b3b651e85f3d7fd48'
2014-03-07 (Fri) 12:35:01: Added 'received/c0/e89f83383d066cc922512dc5eddb5d'
2014-03-07 (Fri) 13:04:32: Added 'received/f5/ff8b132d3c4f8ca63215d8de41de9c'
2014-03-07 (Fri) 13:25:00: Added 'received/9a/848dd40274fe5b6d6bcbad80b2e7fd'

>From that information I could launch notmuch new [files...] 
(or notmuch new --batch !) to index all files since last attempt(*)


Tomi


(*) routine would be: 
	1) get size of last log file (for final stored offset)
        2) read the info of last read log file and offset
        3) feed the filenames between these 2 offsets.
        4) update the final stored offset
        5) check whether the size (or name) of the last log 
	   file has changed and if had, go step 2

> -- Adam

Tomi


More information about the notmuch mailing list