git-gutter icon indicating copy to clipboard operation
git-gutter copied to clipboard

Use window-buffer-change-function hook

Open seven-beep opened this issue 1 year ago • 0 comments

 This variable specifies functions called during redisplay when
 window buffers have changed.  The value should be a list of
 functions that take one argument.

 Functions specified buffer-locally are called for any window
 showing the corresponding buffer if that window has been created or
 assigned that buffer since the last time window change functions
 were run.  In this case the window is passed as argument.

I used more naively this hook for +2 years with in mind to contribute back sometime. Unfortunately as time passed, I lost the memory of a reproducible test case. I think I implemented this after seeing #115 (Git gutter annotations disappearing).

As I finally took the time to present you the hook, I realized that it would mean to obsolete a bunch of functions and variables in the library such as:

  • git-gutter:update-windows-commands
  • git-gutter:pre-command-hook
  • git-gutter:update-other-window-buffers
  • git-gutter:post-command-hook
  • git-gutter:quit-window
  • git-gutter:switch-to-buffer

I also removed the variable git-gutter-mode as it is generated by the minor mode and while testing my changes, its presence caused a small bug of the mode not activating when it should have.

seven-beep avatar Sep 15 '24 12:09 seven-beep