1
0
Fork 0

feat(emacs): add git-link and new function git-link-with-commit

Signed-off-by: Lucas Sta Maria <lucas@priime.dev>
This commit is contained in:
Lucas Sta Maria 2024-11-25 19:19:18 -05:00
parent 0fce415b93
commit 9a42f6ba48
No known key found for this signature in database
GPG key ID: F07FB16A826E3B47

View file

@ -11,6 +11,19 @@
("C-x g" . magit-status)))
(use-package forge :straight t
:after (magit))
(use-package git-link :straight t)
(defun git-link-with-commit ()
"Create a URL representing the current selection for the current commit."
(interactive)
(let* ((link-region (git-link--get-region))
(old-link (git-link (git-link--remote) (car link-region) (cadr link-region)))
(branch (git-link--branch))
(commit (git-link--commit))
(new-link (s-replace branch commit old-link)))
(kill-new new-link)
(message new-link)
new-link))
(provide 'priime-vc)