> And this wouldn't necessarily be just about `M-x'. Once in a while a
> user executes a command that's meant for a totally different mode, and
> then all the text disappears from the buffer and the user is sad. If
> the user manages to type `M-x message-send-and-exit' without TAB
> completion, Emacs could then say "This command is for message-mode, and
> this is a text-mode buffer. Really execute?" or something.
>
I was thinking along the same lines. package.el, for instance, is full of commands which throw errors if not in package-mode. It would be useful if this could be built-in by declaring the mode.