Gmail offers more options for IMAP through an experimental add-on from Gmail Labs: "Advanced IMAP Controls". After enabling the add-on, you'll find two categories of options:
* the Labels tab lets you control which labels show up in your email client, including built-in labels like Drafts, All Mail, Spam or Trash. If you have a lot of messages in your Gmail account, most email clients will perform poorly when processing the "[Gmail]/All Mail" folder, so you might hide it.
* the Forwarding and POP/IMAP tab lets you turn off auto-expunge. "The IMAP protocol allows messages to be marked for deletion, a sort of limbo state where a message is still present in the folder but slated to be deleted the next time the folder is expunged. In our standard IMAP implementation, when you mark a message as deleted, Gmail doesn't let it linger in that state -- it deletes (or auto-expunges) it from the folder right away. If you want the two-stage delete process, after you've enabled this Lab, just select 'Do not automatically expunge messages' under the 'Forwarding and POP/IMAP' tab in Settings," explains Gmail's blog.
If a message is removed from the inbox or from a custom IMAP folder, Gmail still keeps it in "All Mail". You can now change the default behavior and instruct Gmail to send the message to the trash or to delete the message forever.