Recover deleted email (Control-H)

While in Apple Mail, I attempted to invoke the app Hook by pressing Control-H. Hook didn’t launch, so I tried Control-H again, but still no Hook. I then realized that 2 emails that were previously in my mailbox were no longer there. I searched Mail for the missing emails, but couldn’t find them anywhere. I then did a DuckDuckGo search for Apple Mail “Control-H”, and learned that pressing “Control-H” deletes the current message, and can be undone with Command-Z. Supposedly the email is just moved to the Trash folder.

Back in Mail, pressing Command-Z did nothing. Searching through the Trash, I still wasn’t able to find the deleted email.

The email was important, and I’d really like to recover it. Help!?

Freaky that there would be hidden keyboard shortcuts that could delete data. I see that you’re using Yahoo for email so I’d suggest searching on the Web interface (including in Spam and Trash folders) to see if it’s still there. It’s a little unusual for anything to delete email completely without an intermediate trash holding area.

Perhaps a good thing to warn Hook users about, @LucCogZest.

1 Like

Sorry to hear about that.

When Hook first runs, by default it takes over ⌃H. That stays in place unless users disable ⌃H in Hook’s Preferences.

I was not able to reproduce ⌃H deleting email while Hook is configured to use ⌃H. (I.e., if Hook captures the keystroke it consumes it; Mail.app will not be able to respond to it.) Still, we’ll add some documentation about this and keep an eye on it.

Hook actually at first can be triggered by either of two keyboard shortcuts, ⌘⇧SPACEBAR being the other. That one too can be disabled.

(We added ⌃H based on user requests, because it is easier to type and is more memorable (“H” is for “Hook”). But the clash is of course important to note.)

@LucCogZest, in this instance Hook was not running, though I thought that it was. I’d previously rebooted my computer, but hadn’t set Hook up to launch automatically at login. I was attempting to invoke Hook to link it to a particular email, by pressing Control-H, which summarily deleted the email.

I’ve since disabled Control-H from being Hook’s trigger, and remapped it.

1 Like

thank you, @TallTrees . Good point. If it becomes “muscle memory” but is not running it may lead to surprises. Maybe the installation wizard should give users the choice of which keyboard shortcut to use.

2 Likes

@ace, I have several email accounts that I use for various and sundry things, including a couple of my own domains, iCloud, MobileMe, hotmail, gmail, Outlook and my Yahoo (which is my oldest of by a long shot). The email account in question was one of my @me.com, and I searched Mail, signed into iCloud and searched there, and even used HoudahSpot in an attempt to find it. There was no trace to be found, anywhere. I don’t have a clue how the happened, as I retested pressing Control-H on an email message that I didn’t need, and noticed that it was simply moved to the Trash. Very strange!

@LucCogZest, I definitely think that users should be allowed to choose their trigger. :grinning:

1 Like

I’ve noticed on at least 4 occasions when in apple mail and typing something that some combination of keys (probably 2) - I type fast and don’t know what I hit - has caused an email to disappear. Can’t find it in junk, trash or by searching for it even though I know the subject.

It has been weird. Didn’t happen before Big Sur which is the OS I’m using.

David

Apple documents control-H as an equivalent to the Delete key when editing documents. There is no official declaration of its use in the index for a mailbox, but, apparently, Apple Mail also makes it work as Delete key equivalent. Under Monterey, for me, that is how it works; hitting control-H moves the message to the Trash and then highlights the next message in the mailbox.

So, it seems that developers within Apple (and probably independent ones too) tend to use control-H as the equivalent of Delete throughout their applications. It seems quite dangerous for Hook to default to using that combination for a different purpose.

1 Like

Ctrl-H is the standard ASCII control character for Backspace, which is usually mapped to a key marked “Delete” on most computer keyboards. (I am pretty sure ASCII control characters pre-date the existence of Apple as a company.)

Apple Mail has always used Delete as a shortcut for “move to Trash”. Using Mojave Mail, I cannot reproduce the lost-message behavior; it just moves the message to Trash.

2 Likes

Same here with Big Sur (11.6.1).

Ditto for Monterey (12.0.1).

Yes, but only if your app is running in an ASCII-like terminal session, or on a very old computer.

Modern computers with GUIs (and this goes back to the first days of Mac OS, Windows, OS/2 and other desktop GUI systems) have very distinct keystroke codes for backspace and Ctrl-H. If an application wants them to do the same thing, the developer must actually code it to do so.

(I deliberately omitted X11 from the above list because its keyboard handling system is very arcane and complex with default configurations that vary greatly across window managers, desktops and OS distributions, so an app may or may not be able to easily control such functionality.)

1 Like

I wonder if as well as accidentally discovering the ctrl-H ‘delete’ shortcut, you also ran into the Mail data loss bug that’s been present since 10.15, as documented by @mjtsai. The most recent comment on that page indicates that the bug is quite likely still around in the latest MacOS 12 Monterey release.

This is a bit scary.

I use cmd-delete all the time in Mail to remove unwanted messages (along with cmd-shift-delete to empty its trash). But that keyboard shortcut is well spelled out in the Edit menu (a bit odd that it’s there and not in the Message menu, but oh well).

I see no mention in Edit > Delete of ctrl-h, but it certainly seems to do the same thing. How would a user discover such a potentially destructive keyboard shortcut if its not listed in the menu?

And why are there two shortcuts to achieve the same thing? Didn’t there use to be this Apple HIG mantra about not offering the same functionality through multiple conduits?

Since the beginning of Mac OS X (I believe, maybe/probably this started in NeXTStep), Cocoa apps have built-in support for Emacs keybindings. It’s not well documented, and I’m not sure how I first became aware of this as I never use them (having been a vi user back in the day :zipper_mouth_face:). Presumably this comes from NeXTStep’s Unix roots and was convenient, existing muscle memory for most users of NeXT’s computers. It’s highly likely that the email app on NeXTStep also mapped ctl-H to delete; I imagine this behaviour, hidden though it is, has been around a long time.

Technically it is also documented, even though there’s no way to discover it from the interface:

1 Like

Of course! How could I forget? I use ctrl-a, ctrl-k, ctrl-e, and ctrl-t all the time. Thanks for reminding me. :slight_smile:

[Wasn’t vi that odd editor that lacked the rest of the Emacs OS?] :wink:

2 Likes

But the Emacs key bindings typically only work in text areas, and control-H is the help character in Emacs, not backward delete. The backward-delete function is mapped to DEL in Emacs. I think @jajvj1 has it right: it’s related to the historical mapping of the backspace character with backward delete when typing text (outside of Emacs).

In any case, mapping control-H to delete in the context of this thread seems like a pretty questionable decision since the user isn’t entering text where such a mapping would make sense.

1 Like

You’re absolutely right. In Emacs ctrl-d is forward delete, DEL is backward delete.

Depends on your system configuration. When Emacs runs as a GUI app, C-h is help, Backspace is backspace (delete character to the left of the insertion point) and Delete is forward-delete (delete character to the right of the insertion point).

When Emacs is running in a terminal, and the terminal maps the backspace key to Delete, then Delete usually performs a backspace. When the terminal maps the backspace key to Ctrl-H, Emacs often misbehaves (trying to pull up help when backspace is pressed) until you reconfigure it.

Don’t try to draw any universal generalities from the way the Emacs/Unix/X11 world operates. The problem with infinite configurability is that apps needs to somehow deal with it, and there are always situations where they are unable to do so.

Only when using a text terminal (e.g. a VT-xxx series serial terminal or a terminal app that emulates VT-xxx behavior, including xterm). When Emacs is compiled to run as a native GUI app (X11, Windows, Cocoa, etc.) the behavior is different and the defaults are based on what the platform typically implements.

1 Like