Add optional grouping interval to transactions

This allows the callers of `::transact` and `::beginTransaction` to opt-in to undo grouping by providing what I'm calling a 'grouping interval' - a number of milliseconds for which this transaction should be considered 'open for grouping'.

I've got this wired into Atom on [a branch](https://github.com/atom/atom/pull/4071). It feels pretty good, except that undo performance sometimes suffers when many transactions have been grouped. For example, after typing an entire sentence rapidly, hitting `cmd-z` can lag for a moment, presumably because so many `BufferPatches` are being inverted and then applied in sequence.

Let me know what you guys think.
Like I said on the atom branch, think these should be swapped for a slicker calling syntax with the trailing function.