5

I'm moving to emacs from shell/Vim and I'm very used to seeing the branch I'm working in when I'm at the project level. Is there any way to get the Git branch name to display in the dired buffer mode line for my projects?

3

Not at present, no. Maybe dired-k can do it, or one of the other Git related packages I have listed here.

But neither Magit nor VC show this information in Dired buffers. By the way, while Magit uses its own code to update the information displayed in the mode-line of file-visiting buffers, it does so by updating the variable vc-display-status the same way VC would. VC's implementation does many other costly things in its respective function, and because Magit updates the mode-line much more often, it needed an optimized implementation.


If you want to implement this yourself, then look at the linked function and then adapt it for Dired buffers. Then you would have to loop over all buffers to find Dired buffers (similar to what is being done in magit-revert-buffers but much less complicated). Finally to hook this into Magit advice magit-revert-buffers to call your function. (I can also add a hook for that, but only once there actually exists code that could use that.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.