afewmail / afew

an initial tagging script for notmuch mail
ISC License
325 stars 97 forks source link

Ability to skip notmuch hooks when running MailMover #139

Open jhelwig opened 7 years ago

jhelwig commented 7 years ago

If afew --move-mail is added to the notmuch pre-new hook, you'll end up potentially fork-bombing yourself as the hook ends up being called over and over again due to MailMover running notmuch new (https://github.com/afewmail/afew/blob/master/afew/MailMover.py#L118). It would be nice if there was a configuration option for MailMover to tell it to pass --no-hooks to notmuch new to prevent the infinite recursion.

GuillaumeSeren commented 7 years ago

Hey @jhelwig I use the mail-mover without the 'pre-new' hook so it is run in the end, beside being a use-case / configuration problem, I think we should decide if you may be able to run mail-mover multiple time in a single call of afew, to me it's no but maybe there other's use case where it is useful.

jhelwig commented 7 years ago

For some context, what got me down the road of trying to call afew --move-mail from pre-new was the combination of "call afew --move-mails in an offlineimap presynchook" in the afew readme (https://github.com/afewmail/afew/blob/master/README.rst#move-mode) and notmuch's description of the pre-new hook ("Typically this hook is used for fetching or delivering new mail to be imported into the database." https://notmuchmail.org/manpages/notmuch-hooks-5/).

GuillaumeSeren commented 7 years ago

Hey, I think the user is in control, but yeah running only once the 'notmuch new' should be the default, so maybe if it was run, we should just prevent it to run again ?

If you could provide a patch it would be easier to solve I think.