An interactive Emacs function that creates a URL representing the current buffer's location in its GitHub/Bitbucket/Gitorious/... repository at the current line number or active region. The resulting URL will be added to the kill ring.
M-x git-link
With a prefix argument prompt for the remote's name. Defaults to "origin"
.
The default remote name is "origin"
. This can be changed by setting git-link-default-remote
.
git-link-remote-alist
maps remotes' hostnames to a function capable of
creating a URL on that host. To add (or modify) how URLs are created for a given host add
the appropriate function object to this list.
The function's signature is:
HOSTNAME DIRNAME FILENAME BRANCH COMMIT START END
HOSTNAME
hostname of the remoteDIRNAME
directory portion of the remoteFILENAME
source file, relative toDIRNAME
BRANCH
active branch, may benil
if the repo's in "detached HEAD" stateCOMMIT
SHA of the latest commitSTART
starting line numberEND
ending line number,nil
unless region is active