atom/atom-keymap — pull request #43 by maschs (2014-08-03 22:38:31+00:00)
Title: WIP: Keybindings can carry detail information now

Now, this is only a *proof-of-concept* right now, but better then nothing right?

I missed to possibility to transport information in my keybindings. We could use this to insert commonly used snippets for example. I looked into the `atom-keymap` and out came this.

Imagine keybindings like this (the old ones still work perfectly fine):
```coffee
'.workspace .editor:not(.mini)':
'alt-enter': ['editor:insert-custom-snippet', 'legal']
```

What it is supposed to do is invoke `editor:insert-custom-snippet` and pass `legal` as detail. The corresponding function looks like this right now (it's ugly code but you can see what it does):

```coffee
atom.workspaceView.command 'editor:insert-custom-snippet', ({originalEvent}) ->
detail = originalEvent.detail
snippets = atom.packages.activePackages.snippets.mainModule.getSnippets(atom.workspace.getActiveEditor())
atom.packages.activePackages.snippets?.mainModule?.insert snippets[detail]
```

All specs are still passing and the only "bugs" I found so far are:
* To access the detail we have to access `(e) -> e.originalEvent.detail`. Not sure how to set the `detail` directly onto the "main" event.
* Keybinding resolver won't display the target (`editor:insert-custom-snippet`).

What do you think?