34

Every other mail client I have used will remove emails from my sight when I delete them. If I change my mind and want the email back, I can always go look for it in the trash. Why does mutt continue to show emails in my inbox after I have deleted them?

Is it possible to hide them as soon as I delete them?

Cory Klein
  • 18,911
  • "Expunge" is "empty trash"; you probably mean you want it to hide messages that are flagged as deleted. – geekosaur May 11 '12 at 22:02
  • 9
    I suppose some mutt dev long ago decided on this for the default behavior. Showing deleted messages allows you to select and undelete them. If you don't ever intend to use the undelete function, then you could always remap the d key to <purge-message> instead of <delete-message>. – jw013 May 11 '12 at 23:30
  • 3
    Just to add a note, for IMAP this is the protocol's expected behavior. Messages are marked for deletion, but not actually removed until expunged. The purpose is to reduce bandwidth to & from the IMAP server, though this is probably less necessary today than it was 15 years ago. In the last 10 years IMAP clients have increasingly adopted the behavior of moving a message to a Trash folder and immediately expunging or hiding messages marked for deletion from your view. – Michael Sep 26 '12 at 14:13
  • 1
    I rather like the behavior because it allows me to do client filtering (not in Mutt, but others) to "pre-delete" messages I don't usually read, but once in a while want to know what's going on. If I don't care to read them, I just expunge and they go away – Michael Sep 26 '12 at 14:16
  • 1
    Hit "$" to purge/expunge your deleted messages. https://dev.mutt.org/trac/wiki/MuttFaq/Action – editor May 06 '16 at 06:17

5 Answers5

16

You can add a dollar-sign "$" after the "d" and mutt will sync immediately after marking the message(s). Hitting "$" any time will just sync.

  • As far as I understand the question it is about how to delete an email immediately from view without pressing $ to sync. But you are saying the questioner should do this? – Raphael Ahrens Mar 20 '14 at 10:33
6

I believe that jw013 answered the question in his comment:

I suppose some mutt dev long ago decided on this for the default behavior. Showing deleted messages allows you to select and undelete them. If you don't ever intend to use the undelete function, then you could always remap the d key to <purge-message> instead of <delete-message>

Cory Klein
  • 18,911
3
<purge-message> 

is not part of the standard mutt distribution. I verified this by reading mutt's documentation, and asking about it on the #mutt freenode irc channel.

You can try something like this

macro index d "<save-message>+bsdad/trash<enter><sync-mailbox>" "copy message to the trash"

Although it will cause a slight delay (it will take about 1 second to sync the mailbox).

a2f0
  • 131
  • the command <sync-mailbox> has no effect in my case: "<tag-prefix><save-message>=archive<enter><sync-mailbox>". I still see the message marked as deleted. – Martin Vegter Nov 29 '13 at 12:03
  • Is the mailbox really called archive? Try taking the equal sign off the front of it? – a2f0 Jan 06 '14 at 19:49
0
macro index,pager d ":set confirmappend=no delete=yes\n<save-message>=Trash\n<sync-mailbox>:set confirmappend=yes delete=ask-yes\n"

Check Trash is correct name for trash folder.

From this answer.

Jortstek
  • 243
  • 2
  • 10
0

I have this in my .muttrc to help me delete messages as per need

macro index,pager,editor    <F5>        <sync-mailbox>                  "upload mailbox changes upward"
macro index,pager           <F8>        "<delete-message><sync-mailbox>" "delete immediately"

Now, when I want to delete a message immediately, I use F8 key, it takes a second during which mutt marks the message as deleted, followed by syncing with the mailbox. When I want to delete multiple messages, I use d to mark them all followed by F5 to sync mailbox, this saves time over pressing F8 for every message and waiting for it to sync.