syohex/emacs-git-gutter — pull request #30 by nonsequitur (2013-04-28 10:02:04+00:00)
Title: Various Patches

Hi Syohei, thanks for making git-gutter, it's been a joy to use!

Here's a bunch of patches.
All numbered patch sets are more or less orthogonal and can be used independently
of each other.
Feel free to pick any patches and modify them as you please.

#### 1. Fix git-gutter on some Windows platforms ####
**Commits:**

* Revert "Use full path for 'git diff'"

Using full paths breaks git-gutter for 'MinGW Emacs + Cygwin Git' configurations
because Cygwin Git can't handle absolute Windows file paths.

#### 2. Fix `revert-hunk' ####

**Commits:**

* Remove redundant call to 'git-gutter'
It's automatically run by the `after-save-hook'

* Restore window config after revert-hunk

#### 3. Integrate the latest git-gutter-fringe ####
**Depends on my [latest patches to git-gutter-fringe](https://github.com/syohex/emacs-git-gutter-fringe/pull/8)**

The new and improved git-gutter-fringe allows for some simplifications in git-gutter

**Commits:**

* Add 'clear-diff-infos' as the default clear-function
Remove default call to 'remove-overlays' which is not needed for git-gutter-fringe

* Remove init function
It's not needed anymore for git-gutter-fringe

#### 4. Architecture Overhaul No. 1 ####
Never EVER calculate diffs on window-configuration-change.

I'm curious why this was added in the first place.
It's totally sufficient to reset the window margins after a config change.
What's the point in re-calculating the diffs in all visible buffers when
switching to another buffer or doing something in the minibuffer?
For git-gutter-fringe, no window-config-change action is needed at all.

Even with your latest update-threshold hack git-gutter still feels extremely slow:
Often I'm working with 4 open file buffers. When calling - for example -
switch-to-buffer all 4 buffers get re-processed by git-gutter, which
introduces an annoying delay.

Also, there's another problem with the threshold code:
When you quickly switch to another buffer and back to the previous buffer
within the threshold interval, the diff markers on the buffer margin disappear.
(They return on the next call to git-gutter)

**Commits, from old to new:**

* Revert 'Remove unneeded function call',
revert 'Users can control update gutter hook points'

* Revert 'introduce minimal update interval(Default is 1 second)',
revert 'Add explanation of updating gutter threshold'

* Don't use idle-timer to run `git-gutter'

When called by idle-timer, 'git-gutter' will run in the currently active
buffer, instead of the buffer from which 'run-with-idle-timer' was called.
This causes a bug when 'global-git-gutter-mode' turns on 'git-gutter-mode'
in a currently inactive buffer.

* [Refactor] Extract function 'git-gutter:show-gutter'

* Reset window margins on 'window-configuration-change-hook'

git-gutter-fringe can ignore the hook by setting
'window-config-change-function' to nil.

#### 5. Architecture Overhaul No. 2 ####
**Depends on item 4 'Architecture Overhaul No. 1'**

Minimize calls zu git-gutter from various hooks

**Commits, from old to new:**

* [Refactor] Extract functions 'add-local-hooks', 'remove-local-hooks'

* Optimized global mode that avoids redundant diff calculations on file loading

* [Formatting]

* Avoid redundant diff calculations when reverting

#### 6. Post a debug message when diffs are calculated. ####
This is just a debug helper, not meant for release.

**Commits:**

* Debug message when fetching diffs