Re: moving the config into the database [was: Re: [PATCH] Display extra headers for emacs-mua - db config option]
David Edmondson writes: > It seems that only “notmuch new” is currently prepared to create a new > database, but it will also import all of my email before I have a chance > to set the above parameters. > > It seems that the obvious answer is “notmuch config” will create a > database if necessary. Is that the plan? Wouldn't it make sense to have "notmuch setup" do this? d ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: moving the config into the database [was: Re: [PATCH] Display extra headers for emacs-mua - db config option]
On Tuesday, 2019-12-10 at 08:11:56 -08, Jameson Graef Rollins wrote: > Fwiw I support dkg's idea to store the config in the database itself. I > think that's a clean simplification that makes a lot of sense. I'm not inherently against this, but I'm unsure exactly how it would work. For example, I set new.tags and new.ignore in my current .notmuch-config. If they move into the database, how will I set them before I have a database? It seems that only “notmuch new” is currently prepared to create a new database, but it will also import all of my email before I have a chance to set the above parameters. It seems that the obvious answer is “notmuch config” will create a database if necessary. Is that the plan? dme. -- They like the smell of it in Hollywood. ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: script to move messages according to tags
Alan Schmitt writes: > Has someone written such a script that I could copy and > adapt? > > My use cases are: > - find files with a deleted flag not in the Trash and move them to > the > Trash > - find files with an archive flag in my active mail store and move > them > to my local mail store Hi Alan, Below is the script that I use which does more-or-less what you are asking for. The only "magic" here is the function safeMove which strips the identifier number and flags from the filename when a file is moved. These identifier numbers are added by mbsync which is the program I use to synchronise my folders with our webmail server, and keeping the numbers when moving the files proved to interfere with its synchronisation logic. Cheers, Örjan === 8< === #!/bin/bash MAILDIR=$HOME/MyMail # Move a message file while removing its UID-part function safeMove { s=${1##*/}; s=${s%%,*}; mv -f $1 $2/$s; } # Move all deleted messages to the Trash folder echo Moving $(notmuch count --output=files --exclude=false tag:deleted AND NOT folder:Trash) \ deleted messages to the Trash folder for i in $(notmuch search --exclude=false --output=files tag:deleted AND NOT folder:Trash); do safeMove $i ${MAILDIR}/Trash/cur done # Move all spam messages to the Spam folder echo Moving $(notmuch count --output=files tag:spam AND NOT folder:Spam) \ spam-marked messages to the Spam folder for i in $(notmuch search --output=files tag:spam AND NOT folder:Spam); do safeMove $i ${MAILDIR}/Spam/cur done # Move all archived messages from Inbox to Archive folder echo Moving $(notmuch count --output=files folder:Inbox AND NOT tag:inbox) \ archived messages from Inbox to Archive folder for i in $(notmuch search --output=files folder:Inbox AND NOT tag:inbox); do safeMove $i ${MAILDIR}/Arkiv/cur done echo Syncing with Webmail mbsync twoway echo Updating notmuch database notmuch new --no-hooks === 8< === ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: script to move messages according to tags
On 2019-12-11 16:33, David Edmondson writes: How you decide to deal with multiple results is really up to you - in my case I move/delete all of them (except that I don't actually delete anything). This is probably the key: I'm used to file-based MUA that will show me duplicates. If notmuch hides them from me, I could just ignore that they exist (it's not like it's taking too much space anyway…) Best, Alan signature.asc Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: moving the config into the database [was: Re: [PATCH] Display extra headers for emacs-mua - db config option]
On Wednesday, 2019-12-11 at 10:00:07 -04, David Bremner wrote: > David Edmondson writes: > >> It seems that only “notmuch new” is currently prepared to create a new >> database, but it will also import all of my email before I have a chance >> to set the above parameters. >> >> It seems that the obvious answer is “notmuch config” will create a >> database if necessary. Is that the plan? > > Wouldn't it make sense to have "notmuch setup" do this? Oh, yes, of course. I had forgotten that existed :-) dme. -- Tell her I'll be waiting, in the usual place. ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: script to move messages according to tags
On Wednesday, 2019-12-11 at 16:28:20 +01, Alan Schmitt wrote: > I do have one small question: how do you deal with mails that have > duplicates? For instance, when I send a mail to a mailing list, I end > up with both the sent email and the one I later receive from the > list. If I tag the send one with deleted (no need to keep it), won't I > run the risk to delete both mails? If you have the id of a message you can get a list of all of the corresponding files with: notmuch search --exclude=false --output=files $id How you decide to deal with multiple results is really up to you - in my case I move/delete all of them (except that I don't actually delete anything). dme. -- Our President's crazy, did you hear what he said? ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: moving the config into the database [was: Re: [PATCH] Display extra headers for emacs-mua - db config option]
On Tue 2019-12-10 09:46:14 -0300, Jorge P. de Morais Neto wrote: > I hope you don't mind my insistence Insistence is fine -- it sounds like you have a real need for your backup/sync strategy, and if we can figure out a way to support it, that would be good. perhaps we should talk about different ways to get what you're looking for, though. Perhaps you would be satisfied with some sort of "post-config-update" hook? --dkg signature.asc Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: script to move messages according to tags
Hello Örjan, On 2019-12-11 13:58, Örjan Ekeberg writes: Below is the script that I use which does more-or-less what you are asking for. Thank you very much, this is most helpful. I do have one small question: how do you deal with mails that have duplicates? For instance, when I send a mail to a mailing list, I end up with both the sent email and the one I later receive from the list. If I tag the send one with deleted (no need to keep it), won't I run the risk to delete both mails? (Maybe I'm dealing with sent mails in a wrong way… I don't know what notmuch best practice is in that case.) Thanks, Alan signature.asc Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: script to move messages according to tags
Yes, Notmuch considers any email files with the same message-id header as being the same message so won't show you multiple versions of the same email, (unless you're specifically asking for it to with something like --output=files). In normal usage I never worry about the duplicates I get from mailing lists, etc. I hope you'll find notmuch very useful. Have fun! -Carl On Wed, Dec 11 2019, Alan Schmitt wrote: > On 2019-12-11 16:33, David Edmondson writes: > >> How you decide to deal with multiple results is really up to you >> - in my >> case I move/delete all of them (except that I don't actually >> delete >> anything). > > This is probably the key: I'm used to file-based MUA that will > show me > duplicates. If notmuch hides them from me, I could just ignore > that they > exist (it's not like it's taking too much space anyway…) > > Best, > > Alan > ___ > notmuch mailing list > notmuch@notmuchmail.org > https://notmuchmail.org/mailman/listinfo/notmuch signature.asc Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch