One option would be to create ~/Library/KeyBindings/ and save a property list like this as DefaultKeyBinding.dict:
{
"~b" = moveWordBackward:;
"~f" = moveWordForward:;
"~F" = moveWordForwardAndModifySelection:;
"~B" = moveWordForwardAndModifySelection:;
"~d" = deleteWordForward:;
"~u" = (uppercaseWord:, moveForward:, moveForward:);
"~l" = (lowercaseWord:, moveForward:, moveForward:);
"~c" = (capitalizeWord:, moveForward:, moveForward:);
"~v" = pageUp:;
"~V" = pageUpAndModifySelection:;
"^V" = pageDownAndModifySelection:;
"^ " = setMark:;
"^w" = deleteToMark:;
"^x" = {
"^x" = swapWithMark:;
"^m" = selectToMark:;
};
}
It's based on http://www.hcs.harvard.edu/~jrus/site/KeyBindings/Emacs%20Opt%20Bindings.dict. transposeWords: doesn't work in most applications. openDocument: and saveDocument: don't work in applications that use auto-save, and performClose: doesn't work everywhere either.
DefaultKeyBinding.dict doesn't work in Xcode or Firefox or in some text views like AppleScript dialogs. The mark methods aren't really usable with rich text or in TextMate 1. Key combinations that enter dead key states can't be reassigned, but you can remove them by creating a new keylayout with Ukelele.
KeyRemap4MacBook has a predefined Emacs mode group, but for example the setting for changing ⌥F also changes ⌥⌘F to ⌥⌘→. Here's an alternative private.xml:
<?xml version="1.0"?>
<root>
<item>
<name>emacs</name>
<identifier>private.emacs</identifier>
<not>{{EMACS_MODE_IGNORE_APPS}}</not>
<autogen>__KeyToKey__ KeyCode::P, VK_CONTROL | ModifierFlag::NONE, KeyCode::CURSOR_UP</autogen>
<autogen>__KeyToKey__ KeyCode::N, VK_CONTROL | ModifierFlag::NONE, KeyCode::CURSOR_DOWN</autogen>
<autogen>__KeyToKey__ KeyCode::B, VK_CONTROL | ModifierFlag::NONE, KeyCode::CURSOR_LEFT</autogen>
<autogen>__KeyToKey__ KeyCode::F, VK_CONTROL | ModifierFlag::NONE, KeyCode::CURSOR_RIGHT</autogen>
<autogen>__KeyToKey__ KeyCode::P, VK_CONTROL | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_UP, VK_SHIFT</autogen>
<autogen>__KeyToKey__ KeyCode::N, VK_CONTROL | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_DOWN, VK_SHIFT</autogen>
<autogen>__KeyToKey__ KeyCode::B, VK_CONTROL | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_LEFT, VK_SHIFT</autogen>
<autogen>__KeyToKey__ KeyCode::F, VK_CONTROL | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_RIGHT, VK_SHIFT</autogen>
<autogen>__KeyToKey__ KeyCode::B, VK_OPTION | ModifierFlag::NONE, KeyCode::CURSOR_LEFT, VK_OPTION</autogen>
<autogen>__KeyToKey__ KeyCode::F, VK_OPTION | ModifierFlag::NONE, KeyCode::CURSOR_RIGHT, VK_OPTION</autogen>
<autogen>__KeyToKey__ KeyCode::B, VK_OPTION | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_LEFT, VK_OPTION | VK_SHIFT</autogen>
<autogen>__KeyToKey__ KeyCode::F, VK_OPTION | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_RIGHT, VK_OPTION | VK_SHIFT</autogen>
<autogen>__KeyToKey__ KeyCode::D, VK_OPTION | ModifierFlag::NONE, KeyCode::FORWARD_DELETE, VK_OPTION</autogen>
<autogen>__KeyToKey__ KeyCode::V, VK_OPTION | ModifierFlag::NONE, KeyCode::PAGEUP</autogen>
<autogen>__KeyToKey__ KeyCode::V, VK_OPTION | VK_SHIFT | ModifierFlag::NONE, KeyCode::PAGEUP, VK_SHIFT</autogen>
<autogen>__KeyToKey__ KeyCode::V, VK_CONTROL | VK_SHIFT | ModifierFlag::NONE, KeyCode::PAGEDOWN, VK_SHIFT</autogen>
</item>
</root>
The key codes have to be changed for keyboard layouts like Dvorak or Colemak. EMACS_MODE_IGNORE_APPS includes terminal emulators, Emacs applications, and VMs, but you can also add custom appdef elements.