Marking as unread when moving mail to another folder

Sam Kuper sampablokuper at posteo.net
Tue Feb 16 11:31:13 UTC 2021


On Thu, Jul 16, 2020 at 10:57:13AM +0200, Kai Weber wrote:
> I have a save-hook defined to move all mail into a certain folder.
> 
>     save-hook "~A"  +personal/Archive
> 
> Very often I want to move the mail into the archive without opening the
> mail at all but then the mail ends up as unread in the archive.
> 
> I want to mark the mail as "read" when moving. How could I achieve this?
> I guess a macro could do it? Should I get rid of the save-hook?

This macro may do what you want.  It marks mail as "read" and moves it
to the $record file.

Note that it makes use of `<`, which is Mutt's built-in shortcut for the
$record file.


    # Unlike index mode, pager mode does not accept this macro without
    # an initial `<exit>`. So we need two variants of this macro, one
    # for each mode.
    macro index  ss        "<tag-prefix-cond><enter-command>set auto_tag=yes<enter><end-cond><clear-flag>n<save-message><<Return>y<tag-prefix-cond><enter-command>set auto_tag=no<enter><end-cond><sync-mailbox>y"
    macro pager  ss  "<exit><tag-prefix-cond><enter-command>set auto_tag=yes<enter><end-cond><clear-flag>n<save-message><<Return>y<tag-prefix-cond><enter-command>set auto_tag=no<enter><end-cond><sync-mailbox>y<display-message>"


If anyone reading this knows of a better solution, please share it.

Sam

-- 
A: When it messes up the order in which people normally read text.
Q: When is top-posting a bad thing?

()  ASCII ribbon campaign. Please avoid HTML emails & proprietary
/\  file formats. (Why? See e.g. https://v.gd/jrmGbS ). Thank you.


More information about the Mutt-users mailing list