magit / magit

It's Magit! A Git Porcelain inside Emacs.

Home Page:https://magit.vc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Maybe provide an alternative to VC's mode-line information

blaenk opened this issue · comments

My mode-line shows the vc-mode information. When I add a new file that's currently untracked, then I stage it and commit it, the mode-line for that buffer remains as if it's untracked. I have to go to the buffer and do M-x revert-buffer I guess so that it re-triggers visit-file which I believe is when vc-mode is re-run to see if the file is tracked and if so show the information. Of course this is a hassle to do and sometimes misleading because it leads me to believe that I forgot to stage the file.

I was under the impression that magit's auto-reverting would do this for me automatically, a natural consequence being that it would update/show the vc-mode information. However this doesn't seem to be happening, so I believe I'm misunderstanding something.

With emacs 25 onward however, it's possible to refresh the vc-mode state/information without having to revert-buffer. The new M-x vc-refresh-state does this and indeed works perfectly fine and very quickly. I'm wondering if we can have magit run this automatically for buffers that would otherwise be reverted because they were affected by a recent change via magit. Or if you're against that, if we could perhaps add this to some hook so that it would run for affected files, which I believe will have the same effect of updating the information for previously-untracked files.

Actually this can be rather slow when there are many buffers and or files. For now please see https://magit.vc/manual/magit/The-mode_002dline-information-isn_0027t-always-up_002dto_002ddate.html and https://github.com/magit/magit/wiki/magit-update-uncommitted-buffer-hook. The latter explains how you can get this by copying a bit of code to your init file.

But this keeps coming up again and again, so I will look into this again eventually.

Yeah sorry for not noticing that tarsius! I really appreciate the wealth of documentation you've created for Magit. Magit was and continues to be by far largest reason for me switching to Emacs from Vim, and I was so excited about it that I read the manual for Magit from "cover to cover," so I hope you don't think your great documentation goes to waste, I just forgot that you had already covered this.

But this keeps coming up again and again, so I will look into this again eventually.

It doesn't do that anymore and I really don't want to implement it because I don't think it is useful and because it would be a lot of work.