No doubt you've already considered this, but Emacs does what you want via custom key maps and function hooks. Of course, it's probably more horsepower than you need. I don't claim any expertise in Emacs, but I had to solve a similar problem on an operating system long ago and far away (OpenVMS/TPU). Emacs and TPU are close enough where your problem description's concerned.
Can you describe what problem you're trying to solve? Maybe there's another way to the goal. -- microsoft free by 2003 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]