Doom Emacs

doom emacs has a command line interface that is still in early works (as of July 2022).

Search and replace across project

  • SPC s p search
  • C-c C-e to open an editable buffer
  • Z Z to write and commit changes Z Q to abort

Fix for vertico and doom doctor warning on lookahead for grep and ripgrep on macOS

When running doom doctor you may get:

      ! The installed ripgrep binary was not built with support for PCRE lookaheads.
          Some advanced consult filtering features will not work as a result, see the module readme.
      ! The installed grep binary was not built with support for PCRE lookaheads.
          Some advanced consult filtering features will not work as a result, see the module readme.

For ripgrep, try installing ripgrep from brew again or:

brew uninstall ripgrep
brew install rust
cargo install --features pcre2 ripgrep

For grep, install grep from homebrew and then add it to PATH

brew install grep
# In .zshrc/.bashrc
if [ -d "$(brew --prefix)/opt/grep/libexec/gnubin" ]; then
    PATH="$(brew --prefix)/opt/grep/libexec/gnubin:$PATH"
fi

Setup for integration with Github:

forge is a built in part of magit which allows you to interact with Github Issues and PRs. code-review is a library that allows you to comment and modify a PR review directly in emacs.

Authentication

Both libraries require a personal access token to operate.

  1. Create a new personal access token with the scopes read:org, repo, user (these are the permissions necessary for forge). I used this token for both code-review and forge. You could create a slightly less scoped token for code-review but that the difference is marginal.
  2. open ~/.authinfo.gpg in emacs. Assuming you have gpg setup correctly, it will automatically encrypt/decrypt this file.
  3. Add the following line:
    machine api.github.com login GITHUB_USERNAME^forge password PASSWORD
    machine api.github.com login GITHUB_USERNAME^code-review password PASSWORD
    
    Replacing GITHUB_USERNAME with your username and PASSWORD with the token you just generated
  4. Save and close the file

Forge

  1. Navigate to the repo you want to operate on
  2. With default doom-emacs bindings, open the forge dispatch SPC g '
  3. a to add the repository
  4. Reinvoke the dispatch and run f f to pull all pull requests and issues

Code Review

While on a PR, SPC g ' c r will open up a code-review session for that PR. Most commenting can be invoked with a RET at proper places. Submit a PR by hitting r and completing the menu as desired.

Links to this note