Re: avoid multiple deletion of same mail?
Dear Michael, dear Cameron, * Michael Tatge tatg...@gmail.com [2015-07-22 14:17]: * On Wed, Jul 22, 2015 11:35AM -0400 Peter P. (peterpar...@fastmail.com) muttered: I have bound the 'd' key to move mails to a trash folder, and 'D' to move an entire thread to a trash folder: folder-hook . 'macro index,pager d save-message=INBOX.Trash \r folder-hook . 'macro index,pager D tag-threadtag-prefixsave-message=INBOX.Trash \r This doesn't prevent me from accidentally moving these messages twice, eg when the first mails in a thread are deleted using 'd' (and are marked deleted accordingly) with a subsequent use of 'D' the entire thread, including the messages that got deleted already, gets saved to the trash folder again, causing duplicates. You could use the trash folder patch included in most distros. Then you wouldn't need those macros. I managed to change to the trash folder patch and have been using it successfully for a week by now. Thank you for suggesting it Michael, and thank you Cameron for your instructions on how to write a godd macro that could indeed do without the above patch and which made me learn a lot. cheers, P
Re: avoid multiple deletion of same mail?
On 22Jul2015 11:35, Peter P. peterpar...@fastmail.com wrote: I have bound the 'd' key to move mails to a trash folder, and 'D' to move an entire thread to a trash folder: folder-hook . 'macro index,pager d save-message=INBOX.Trash \r folder-hook . 'macro index,pager D tag-threadtag-prefixsave-message=INBOX.Trash \r Minor remark: I bind ^D (ctrl-D) to delete thread; D is already bound to delete pattern. This doesn't prevent me from accidentally moving these messages twice, eg when the first mails in a thread are deleted using 'd' (and are marked deleted accordingly) with a subsequent use of 'D' the entire thread, including the messages that got deleted already, gets saved to the trash folder again, causing duplicates. Is there a way to execute above scripts only on messages and threads whose status is not 'deleted'? I would do 3 things: - leave the first macro alone; it is hard to point at a deleted message (mutt tends to skip the the next undeleted message), so personally if I were on a deleted message and pressed d I'd want it to just do it - look at the $delete_untag setting, which clears the tag on a message if you delete it - modify the second macro, eg (untested): macro index,pager D tag-threaduntag-pattern~Dentertag-prefixsave-message=INBOX.Trashenter That should tag the thread, untag any deleted messages, then move. Actually, I would extend that macro to flush any existing tags as I presume you don't want to delete the thread plus anything else that happened to be tagged. So: macro index,pager D untag-pattern~Tentertag-threaduntag-pattern~Dentertag-prefixsave-message=INBOX.Trashenter Another note is I split my macro like this into two, thus: macro index D untag-pattern~Tentertag-threaduntag-pattern~Dentertag-prefixsave-message=INBOX.Trashenter macro pager D qD i.e. inside the pager the macro just exits to the index and then runs delete thread. Again, I recommend using ^D instead of D for this macro. Your call, obviously. Cheers, Cameron Simpson c...@zip.com.au In article 323c4db9.6...@ss1.csd.sc.edu, lhart...@ss1.csd.sc.edu wrote: | It still is true that the best touring bike is the one that you are | riding right now. Anything can be used for touring. As long as you | can travel, you are touring. I beleive such true and profound statements are NOT allowed to be posted in this newsgroup, and are also against the charter. You've been warned. - Randy Davis DoD #0013 ra...@agames.com in rec.moto
avoid multiple deletion of same mail?
Hi list, I have bound the 'd' key to move mails to a trash folder, and 'D' to move an entire thread to a trash folder: folder-hook . 'macro index,pager d save-message=INBOX.Trash \r folder-hook . 'macro index,pager D tag-threadtag-prefixsave-message=INBOX.Trash \r This doesn't prevent me from accidentally moving these messages twice, eg when the first mails in a thread are deleted using 'd' (and are marked deleted accordingly) with a subsequent use of 'D' the entire thread, including the messages that got deleted already, gets saved to the trash folder again, causing duplicates. Is there a way to execute above scripts only on messages and threads whose status is not 'deleted'? Thank you for all ideas! Peter PS: Does anyone know of a simple way to disply identical duplicated messages with mutt, and optionally delete only the duplicates?
Re: avoid multiple deletion of same mail?
* On Wed, Jul 22, 2015 11:35AM -0400 Peter P. (peterpar...@fastmail.com) muttered: I have bound the 'd' key to move mails to a trash folder, and 'D' to move an entire thread to a trash folder: folder-hook . 'macro index,pager d save-message=INBOX.Trash \r folder-hook . 'macro index,pager D tag-threadtag-prefixsave-message=INBOX.Trash \r This doesn't prevent me from accidentally moving these messages twice, eg when the first mails in a thread are deleted using 'd' (and are marked deleted accordingly) with a subsequent use of 'D' the entire thread, including the messages that got deleted already, gets saved to the trash folder again, causing duplicates. You could use the trash folder patch included in most distros. Then you wouldn't need those macros. Is there a way to execute above scripts only on messages and threads whose status is not 'deleted'? You could add a sync-mailbox after the first macro. Though that might be expensive depending on the mailbox type and/or unwanted since you don't get the chance to undo. With the first message out of the way, you don't get dups. PS: Does anyone know of a simple way to disply identical duplicated messages with mutt, and optionally delete only the duplicates? See Section Pattern Modifiers in the Manual. ~= duplicated messages (see $duplicate_threads) limit l show only messages matching a pattern delete-pattern D delete messages matching a pattern HTH, Michael -- PGP-Key-ID: EEE7D043 Jabber: in...@jabber.de