Mapping delete key to "Archive" in Mail

Similar to how Mail.app works on iOS, I'd like to make OS X treat the delete key as an Archive button. The main issue is making sure that the delete key only works this way when a mail message is selected, not when I'm trying to delete text.

This is the best I've been able to come up with, but the problem is if I have Spotlight or Fantastical open above Mail, KM will still consider Mail the front window. So, if I delete some text I entered into Spotlight, it'll Archive a bunch of messages in a row.

Any thoughts as to how I can make this work better?

Correct me if I am wrong, but this will archive the selected message anytime you ht the delete key and you are not in a compose window, including when you are typing in the “Find” field.

(I know this is an old topic, but I was looking to do something similar with ‘J’ for junk and I couldn’t search for anything with a j in the search term)

The trick is in when the "Archive" item is available in the "Message" menu -- it isn't active when, for example, the insertion point is in the "Find" field or the active selection is a mail folder rather than a message.

Well, I just tried it. Typed "Netflix” in the search field, selected a message in the list, clicked in the find filed and hit delete, and the message was archived and nothing was deleted in the find field.

Are you, perchance, using Mail in Monterey?

On my test machine running 10.14, Mail (v12.4) works as OP intended because when I replicate your actions the click into the "Find" field disables the menu item. In Monterey, the menu item remains active and the previously selected message is indeed archived.

Things change, and old posts always have to be considered in their temporal context.

That said, I find using Delete as a hotkey for this to be a very strange choice. I make far too many silly mistakes already, and teaching my fingers that Delete means anything other than deletion is asking for trouble!

1 Like

Ah, that makes sense. Yes, all Monterey household here now since we went all M1.

I can understand wanting to use delete as you go if you are in a position where you pretty much keep all your non-junk mail as it’s fast, out of the way, and a single key—you can just open up the inbox, select the first message, and hit ‘delete’ as you go. It’s not how I work (I delete the kruft in occasional cleaning sessions and then archive the remains with ⌘-A, ⌃⌘-A to select all and archive all.

The most likely mistake is archiving a message you meant to delete, and that’s not an irrecoverable error.

It's not just likelihood you need to account for -- it's also consequences.

You picked up on the problem straight away. Imagine if you'd been using KM in 2016, found this macro, and used it happily for a few years. You then upgraded to whatever OS broke it. Unless you regularly check your Archive or Trash folders you wouldn't notice for a while -- and if you've got "Keep Deleted" set to 30 days, or worse yet you purge Deleted on quit, you could lose a lot of mail you thought was safely archived.