avendael/atomic-emacs — pull request #10 by oggy (2014-03-30 18:24:01+00:00)
Title: Better mark implementation

I found the existing mark implementation had a couple of issues:

* Firstly, I found clearing the selection often didn't work. It looks like `retainSelection` is a property of Selection, not Marker (maybe this changed). Either way, this seems like a piece of private state that ideally we wouldn't depend on.

* Secondly, for the mark to function correctly, all commands must be made mark-aware. This means we need to define our own version of every motion command, and even if we could do that, other plugins that move the cursor would not work well with it.

This implementation instead hooks into cursor movement events to extend the selection. It also clears the selection when the text changes (the Emacs default). All the commands that only exist to call `doMotion` now disappear -- these keys can now simply be bound to Atom built-ins.

Finally instead of binding mark deactivation to `ctrl-g`, we simply append this functionality to `core:cancel`, and bind `ctrl-g` to that -- this means escape now clears the mark too, which feels more intuitive.