Mail.app in Mac OS 10.7 added an Archive button. Unfortunately, when archiving a message in a Gmail account, instead of simply putting the message into All Mail folder, Mail.app creates a folder called Archive (in Gmail web interface this folder comes up as [Imap]/Archive) and puts the message there. Is there a way to tell Mail to put the archived messages into Gmail's All Mail instead?
I created an AppleScript to move messages to [Gmail]/All Mail though and then created a service so I can run it from a keyboard shortcut. The AppleScript is here: http://gist.github.com/1134751 I'm not thrilled with it's performance though.
FastScripts (http://www.red-sweater.com/fastscripts/) could be be used to assign a keyboard shortcut to the script itself - without having to turn it into a service.
It seems that it's easier to turn off the "Move deleted message to Trash mailbox" in the Mailbox Behaviours tab of the Gmail account preferences and continue using the usual Delete button instead of the new Archive button. This way when you delete the message it is simply removed from Inbox, i.e. in Gmail terms "archived".
I don't know how to change the button action.
However, it is possible to create a keyboard shortcut to Archive a message using the commercial plugin Mail Act-On. After watching a couple of the tutorials, I wrote an Act-On rule for every one of my accounts that archives ("moves") the message(s) to the correct [Gmail]/All Mail folder. You can map all of the rules to the same keystroke (I used Control-A) and tell each rule to stop when matched.