blahgeek / emacs-pr-review

GNU General Public License v3.0
43 stars 2 forks source link

Emacs PR Review

Review Github Pull Request from Emacs!

Prepare

Install

Setup github token

This project uses ghub, see its document for more details about how to setup the token.

Simply put, add the following line to ~/.authinfo (replace <...> accordingly):

machine api.github.com login <YOUR_USERNAME>^emacs-pr-review password <YOUR_GITHUB_PERSONAL_TOKEN>

You may customize username and api host (for github enterprise instances) using ghub, or you can also set pr-review-ghub-username and pr-review-ghub-host for pr-review only.

Usage

This package provides the following entrypoint:

Suggested config (especially for evil users):

(evil-ex-define-cmd "prr" #'pr-review)
(evil-ex-define-cmd "prs" #'pr-review-search)
(evil-ex-define-cmd "prn" #'pr-review-notification)
(add-to-list 'browse-url-default-handlers
             '(pr-review-url-parse . pr-review-open-url))

Personally I suggest two possible workflows:

  1. Use pr-review-notification as your "dashboard" and enter PR review from it.
  2. Use notmuch (or some other email client in emacs) to receive and read all github notification emails and start pr-review from the notmuch message buffer. Running pr-review in the email buffer will automatically find the PR url in the email.

Keybindings in PrReview buffer

There's three most-used keybindings:

There's also buttons (clickable texts) for major actions (e.g. reply, submit review), you can just use them.

Some other keybindings:

Evil users will also find some familiar keybindings. See describe-mode for more details.

Keybindings in PrReviewInput buffer

When you are adding or editing the comment, you will be editing in a new PrReviewInput buffer. Keybindings in this buffer:

Keybindings in PrReviewNotification buffer

Actions in this buffer works like dired: items are first marked, then executed: