Search and insert the right issue at “Fixes #”
Goal: In a magit commit buffer, I want to complete the issue when I type “Fixes #”.
For Github, Gitlab and Bitbucket.
Works with individual projects (repo of type username/projectname), groups (groupname/projectname) and forks (where the issues are on the original repo).
Gitlab and Bitbucket: works with private projects.
Bitbucket: install bitbucket.el (in melpa).
Activate the minor mode
In a magit commit buffer (
git-commit-mode), type “Fixes #” (or any
other keyword understood by github, or just a “#” for Gitlab) and choose
the issue from the list.
So to always activate it:
(add-hook 'git-commit-mode-hook 'git-commit-insert-issue-mode)
You can also call it with
and programmatically doing something like
(--map (insert (concat it "\n")) (git-commit-insert-issue-github-issues-format "inkel" "github-issues.el"))
Connect to your Gitlab/Bitbucket account
Don’t forget to set your Gitlab credentials:
(setq gitlab-host "https://gitlab.com" gitlab-username "foo" gitlab-password "password")
normally you would then call
M-x gitlab-login, but the lib does it when needed.
For Bitbucket, see its README, but shortly it boils down to
(setq bitbucket-basic-auth "my-basic-auth-token")
M-x package-install RET git-commit-insert-issue RET
(you may need a
Alternatively, you can download this repo and call
M-x load-file on the
They are all in MELPA.
Feedback on emacs-gitlab: it’s very well written but monolithic and not very flexible. It has functions for every action of the api (glab.el takes another approach, the developer writes the api endpoint) but it seems it wasn’t written for practical stuff in mind. For example, it didn’t have an option to fetch only the opened issues of a project, or optional function arguments to make it easier to develop. See this PR as an example.
Doc is missing, but once you understand that a project can be referenced by “username/project”, it’s easier.
- the helm integration is broken, we then simply use ido.
- if you play too much with it, you can reach github’s rate limit.
(--map (insert (concat it "\n")) (git-commit-insert-issue-github-issues-format "inkel" "github-issues.el")) #10 - Why not just use the gh package? #1 - Doesn't work on private repos.
- [X] gitlab integration:
- [X] Get opened issues from gitlab
- [X] Get a list of strings with “id - title”
- [X] choose with ido and insert in buffer:
- [X] choose github or gitlab, depending on project.
- [X] get the remote server in git config
- [X] make it work for projects in groups (i.e, “emacs-stuff/project” and
- [X] get the group name in git config
- [±] error handling (bad project name, etc)
v0.3 <2017-04-24 lun.>
- Add Bitbucket support (Tjaart van der Walt)
- Gitlab support: private and public, individual, groups or forks.
We then consider the project url and username of the first
remote to appear in the user’s
- ido (with \n) instead of helm
- auto gitlab login
- more error handling
- github-issues dependency in melpa
v0.1 - release on Melpa
- Github only