4

The release notes for magit 2.1.0 state "Branch descriptions can now be displayed in the refs or status buffer". However, I can't find these features documented in the info pages. I am using magit 20150701.1326.

1 Answer 1

6

For some buffers, including status and refs buffers, Magit now uses customizable hooks. Such hook variables are named magit-{*}-sections-hook. All functions that insert sections are named magit-insert-WHAT. To add functions to section hook variables use magit-add-section-hook. It offers a little more control over where exactly the function is inserted, than plain add-hook. So try this:

(magit-add-section-hook 'magit-status-sections-hook
                        'magit-insert-branch-description
                        nil t)

and/or

(magit-add-section-hook 'magit-refs-sections-hook
                        'magit-insert-branch-description)
3
  • I tried this and it seems to replace the existing header (magit-insert-head-header) with the branch description header, instead of inserting it. Jul 3, 2015 at 14:24
  • Right. I thought it was a section intended as a header line, but it's actually a full, collapsible section. I have adjusted the answer.
    – tarsius
    Jul 3, 2015 at 14:37
  • That was quick :)
    – tarsius
    Jul 16, 2015 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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