sigma / magit-gh-pulls

Magit plugin for dealing with GitHub pull requests
254 stars 48 forks source link

Option for hiding message when not cached #123

Open raxod502 opened 6 years ago

raxod502 commented 6 years ago

This message is displayed in the Magit status buffer when the list of PRs has not yet been fetched:

Pull Requests:
Press `M-x magit-gh-pulls-popup g` to update the pull request list.

I would prefer for no such message to be displayed in that situation. Here's my workaround:

(defun radian-advice--hide-section-when-not-cached ()
  "Hide the \"Pull Requests\" section when the list is not cached.
This is a `:before-while' advice advice for
`magit-gh-pulls-insert-gh-pulls'."
  (when-let ((repo (magit-gh-pulls-guess-repo)))
    (magit-gh-pulls-requests-cached-p
     (magit-gh-pulls-get-api) (car repo) (cdr repo))))

(advice-add #'magit-gh-pulls-insert-gh-pulls :before-while
            #'radian-advice--hide-section-when-not-cached)