hook - Emacs: Update git-gutter annotations when staging or unstaging changes in magit-status buffer -


I use to view changes in version-controlled files, and magit staging / Doing for Dieting / Diffing etc.

When I work on a project, I usually open a maget-status window all the time. The problem I have is that when I make changes to buffer in maget-status and then show the file whose status I update now, created by Fringe Annotation git-gutter are not automatically adjusting ( Cx to save the file after Backspace is my current solution for triggering an update. , But it is not very efficient.)

I looked at git-gutter.el , and provides a customizable variable to ensure that the Git-gutter: update-hooks is called

  (later-save-hook-after-back-hook window-configuration-change-hook) by default  

So I really need to add the right hook in this list and I would love to go Walking while switching windows What is Hook's name? I have seen different sections of the Ellip Manual and I can not find what I am looking for.


Edit :

If alternatively, Megit provides a hook that staging or uninstalling Changes? You are reading this because you are faced with a similar problem: I am resolving both of the answers below! For newer versions of Magazine , little and sweet is required to add a little more custom code, but comes with generalized (!) Advice to create custom hooks and inject them into existing functionality , Because I can only accept one answer: Boost your SO Karma by rewarding both posters with the upvote :)

edit R : With the latest versions of magit and git-drain, now it does not need such a lot of configuration, and to see more updates see the answer to lunaryorns simple solution.


Basic Answer:

Switching window method can be slightly elevated, because you will refresh more

< P> Magit does not provide the strike before / after / without strike, although we can make our own hook through advice!

You can define two variables for your stage and remove the hooks.

(after Me-Maggat-Stage-hook Neil "Run a hook to run after an item in Magit") (One in Magit Use the hook to run after placing the item.))

Function to run a good wrapper hook: after the magit-stage-item To run our custom hook and run 'Mary-Maggit-Four-Stage-Hook' after creating an item in magit-unstage-item

 

For our hook we can repeat all buffers again, and when Refresh git-gutter if we do not know whether it is phased or unstable, so we will refresh the git-gutter display on all visible buffers running git-gutter-mode. (If you want to do all the git-gutter buffers, just delete the get-buffer-window call.)

 < Code> (Refresh git-gutter-mode on all saved git-gutter-mode buffers.) (Doctor (buffer-list) (current-current-buffer buffer (when (and git-gutter-mode (get -buffer-window buff)) (git-gutter-mode t))))  

Finally, just add your hook function to your custom hook!

  (ad-hook 'my-magit-after-unstage-hooks' my-refresh-visible-git-gutter- buffers) Hook 'Mary-Maggat-to-Stage-Hook' My Refresh-View-GIT-Gutter-Buffers) Ideally we would know which file was found if you had a deep magnetic function But you can use around the advice and only get the name of the Maggett status buffer item which you are working on and refresh only but this is a good start! 

Auto GIT Jitter Refreshing


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -