Skip to content

WillForan/emacs-git-bug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-bug elisp functions for emacs

https://melpa.org/packages/git-bug-badge.svg

A minimal interface to git-bug for Emacs.

This package provides a completing-read menu to match existing bugs and another menu to act on a bug.

Good entrypoints and canidates for assigned keybindings are

  • git-bug-menu
  • git-bug-new-from-line

A nearly novel[fn:1] feature is M-x git-bug-new-from-line. This function will create a new git-bug from a line like

# TODO: a commented note for later in the source code

and then add the bug reference to the line, so the outcome of running the function is an updated line like

# TODO(gb#abcd123): a commented note for later in the source code

doc/demo-inline.gif doc/demo-menu-close.gif

[fn:1] VS code’s github-issue-integration also does similiar. Are there other implementations?

Highlights

git-bug-menuChoose a bug and than action each from a list.
git-bug-new-from-lineCreate a bug from TODO/FIX/BUG: on the current line.
git-bug-edit-at-lineEdit first match of gb#1234567 on the current line.
git-bug-lsUse ‘git bug‘’s built-in ‘org-mode‘ format to display all bugs.

git-bug-menu actions

From git-bug-menu-actions-alist

showCreate a new buffer to show this ‘bugid‘’s title and it’s comments.
editEdit bug ‘BUGID‘ in temporary buffer.
insertInsert gb# issue number at current position in buffer.
closeClose issue.
commentCreate a new comment for bug ‘BUGID‘ in via EDITOR.
openReopen issue.
rmRemove issue.

Setup

Here’s an example install and configure for ~/.emacs.d/init.el using use-package-vc-install (Emacs 30)

(use-package git-bug
  ;; in MELPA, for directly from git, use
  ; :vc (:url "https://github.com/WillForan/emacs-git-bug")
  :ensure t
  :bind
  ("C-c b m" . git-bug-menu)
  ("C-c b c" . git-bug-new-from-line)
  :config
  (evil-leader/set-key "#" #'git-bug-menu)
  (evil-leader/set-key "3" #'git-new-from-line))

Kludge

git-bug-edit-bug and git-bug-comment-new use git-bug’s built in edit-from-cli setup (gb#cc5fa60). This works well in emacs if

  1. emacs is launched like emacs --daemon or you’ve run server-start from within
  2. EDITOR on system environment has been set to e.g. emacsclient -c

See also

git-bug

Initial Setup

Getting started with git-bug can be tricky (git-bug#1331), especially pointing to ssh keys (git-bug#1023) and initializing an identity (git bug user new).

Those can both be accomplished like

# ssh-agent git identity for pushing (cf. gpg-agent)
if [ -z "$SSH_AUTH_SOCK" ]; then
  eval $(ssh-agent -s)
  ssh-add ~/.ssh/id_ed25519
fi

# $PWD/.git/config [git-bug] 'identity' section.
# implicit defaults made explicit, plus gravatar
git_email=$(git config get user.email)
avatar_url=https://www.gravatar.com/avatar/$(tr -d '\n' <<<  ${git_email,,} | sha256sum | cut -f1 -d' ')
git config get git-bug.identity ||
  git bug user new \
    -n "$(git config get user.name)"\
    -e "$git_email" \
    -a "$avatar_url"

Current Issues

Putting the issues here for fun. Fun that costs an easily out of date and/or high-churn readme.

git-bug bug -s open -f json |
 jq -r '.[]|[.create_time.time[0:10], .id[0:7], .title]|@tsv' |
 sort -nr
datebugtitle
2025-09-0159e13c7git-bug-new-from-line should include file:line when creating
2025-08-31cc5fa60refactor new and edit so edit can reuse temp buffer of new
2025-08-317b002aeneed to exit and return when bug is saved. also regexp is wrong?
2025-08-30e7a8b7cedit message color like commit-message
2025-08-3094e034cgit-bug porcelain for magit-forge
2025-08-306588bc5list of git-bug project directories for overview of all page
2025-08-303a93c2eminor-mode for clickable buttons, company/cornfu completion?

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published