From 9a42f6ba48bb4e84e5c31f0a50e77cb0afa5d6b2 Mon Sep 17 00:00:00 2001 From: Lucas Sta Maria Date: Mon, 25 Nov 2024 19:19:18 -0500 Subject: [PATCH] feat(emacs): add `git-link` and new function `git-link-with-commit` Signed-off-by: Lucas Sta Maria --- .emacs.d/include/priime-vc.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.emacs.d/include/priime-vc.el b/.emacs.d/include/priime-vc.el index 1ba6f20..8cbd563 100644 --- a/.emacs.d/include/priime-vc.el +++ b/.emacs.d/include/priime-vc.el @@ -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)