-
Notifications
You must be signed in to change notification settings - Fork 99
allow to specify args for notmuch new #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Can you use #187 for that? |
First of all, sorry for not searching the issues before... #187 is not quite it but #188 looks promising since it updates the notmuch db (even more effectively) but avoids hooks. It implies a change in behaviour for those users which use hooks (in my case, welcome change). I'll try #188 and report back. |
|
So, that approach (use notmuch bindings, not the binary) works and looks better all together, but the implementation is lacking (ignores rename setting). Cleaning up that patch over there seems to be worthwhile if you decide that the change in behaviour is OK (no more hooks being fired - fine for me :)). |
|
Hey, I agree on the feature as a heavy user of the MailMover myself, I will check the patch, but i think if it can solve both your issue (#200) and (#187), @vanicat Can you have a look and check if it solve your issue ? |
|
#200 is for I consider using it in the
|
This depends on your use of MUA and synchronisers. For me, the MUA only changes tags in the notmuch db or adds messages (sending), i.e. it operates through the nm library and the db is in sync locally. afew/notmuch does the remote sync, which encompasses fetching/pushing of e-mail including necessary moves by tag and tagging by folder. This has to be done in a specific order to make sense. My ordering ist:
I could not come up with any other ordering that makes sure that db and local state and remote state are in sync and that requires only one run of notmuch, mbsync and the two afew modules. But I'd be happy to learn alternatives. |
|
I'm currently moving from Thunderbird to a more open mail store. I have set up a mail sync script, that basically does
My
remote is synched only the next time my sync script is called.
I mean, remote and local will get out of sync anyway. |
In move mode, afew calls `notmuch new` after moving mails around. This prevents `afew -m` from being used in a pre-new hook in `notmuch`. Allow to specify args, so that `afew -m --notmuch-args=--no-hooks` can live happily in a pre-new hook.
`:flags` need to be preserved when renaming files, but UIDs of the form `U=[0-9]+` should be removed. The current code fails to do that when a mail file has a UID but no flags. Change the code to nuke the non-flag part in any case.
Refactor so that the name generation becomes clearer, and before changing the dir generation. Change in behavour: returns a full path instead of a dir now in the rename==False case.
Currently, MailMover moves all mail to `/cur`. But everyone moving mail from `/new` to `/cur` is required to set up the maildir flags field in the name. Rather than setting up that field, preserve the maildir subdir part and let other clients change subdirs as necessary. After all, "moving" does not constitute "reading".
|
Ok let's merge this thank you for the patch @mjg ☕ |
| to_delete_fnames = [] | ||
| moved = False | ||
| for query in rules.keys(): | ||
| destination = '{}/{}/cur/'.format(self.db_path, rules[query]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did that cur here go?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparantly, #200 and #201 got merged together when they were both merged (or I rebased one PR branch too early, or github computes the diff relative to the original merge base).
In any case, this is reflected in the change to new_name(): In short, afew used to move mail from new to cur but failed to update flags (everyone moving to cur should update flags), so #201 made afew leave mail in the respective subdir rather than chopping off new/cur/.. and appending cur..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but this still doesn't feel quite readable to me.
I could guess submaildir is cur or new, but just taking [1] out of os.path.split()'s tail sounds scary - what happens to the other path components?
Could this maybe be made slightly more readable way, maybe by adding some comments?
We could also probably use pathlib paths around instead of strings.
In move mode, afew calls
notmuch newafter moving mails around. Thisprevents
afew -mfrom being used in a pre-new hook innotmuch.Allow to specify args, so that
afew -m --notmuch-args=--no-hookscanlive happily in a pre-new hook.