這個類似git-link
(不依賴github token)
我常用的非github repo是musl和sourceware系列(glibc,binutils-gdb,…):
(after! git-link
(defun git-link-llvm (hostname dirname filename branch commit start end)
(format "https://github.com/llvm-mirror/%s/tree/%s/%s"
(file-name-base dirname)
(or branch commit)
(concat filename
(when start
(concat "#"
(if end
(format "L%s-%s" start end)
(format "L%s" start)))))))
(defun git-link-musl (hostname dirname filename branch commit start end)
(format "http://git.musl-libc.org/cgit/%s/tree/%s%s%s"
(file-name-base dirname)
filename
(if branch
""
(format "?id=%s" commit))
(if start
(concat "#" (format "n%s" start)) "")))
(defun git-link-sourceware (hostname dirname filename branch commit start end)
(format "https://sourceware.org/git/?p=%s.git;a=blob;hb=%s;f=%s"
(file-name-base dirname)
commit
(concat filename
(when start
(concat "#" (format "l%s" start))))))
(add-to-list 'git-link-remote-alist '("git.llvm.org" git-link-llvm))
(add-to-list 'git-link-remote-alist '("git.musl-libc.org" git-link-musl))
(add-to-list 'git-link-remote-alist '("sourceware.org" git-link-sourceware))
)
2 个赞