diff options
author | David Morgan <djm_uk@protonmail.com> | 2024-01-02 16:19:10 +0000 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2024-01-02 16:19:10 +0000 |
commit | a78e5cd4463677b4b56e14b051bfd494a775b0e6 (patch) | |
tree | 046876775b681ed457f50680316763d00f74169e | |
parent | 3debbb1a943f59402d833b0b3a4d5481e739d227 (diff) | |
download | dotfiles-a78e5cd4463677b4b56e14b051bfd494a775b0e6.tar.gz |
Add git-link-blame function
-rw-r--r-- | .emacs.d/lisp/init-git.el | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/.emacs.d/lisp/init-git.el b/.emacs.d/lisp/init-git.el index 2e8dbf9..1d7183e 100644 --- a/.emacs.d/lisp/init-git.el +++ b/.emacs.d/lisp/init-git.el @@ -323,6 +323,14 @@ GitHub/Bitbucket/GitLab/... The URL will be added to the kill ring. If (if (null (car remote-info)) (message "Remote `%s' contains an unsupported URL" remote) (git-link--new (format "https://%s/%s/tree/%s" (car remote-info) (cadr remote-info) branch))))) + ;; https://clojurians.slack.com/archives/C099W16KZ/p1699983189128519?thread_ts=1699981599.260029&cid=C099W16KZ + (defun git-link-blame () + (interactive) + (cl-flet ((git-link--new* (x) (replace-regexp-in-string "/blob/" "/blame/" x))) + (advice-add 'git-link--new :override #'git-link--new*) + (let ((link (call-interactively 'git-link))) + (advice-remove 'git-link--new #'git-link--new*) + (git-link--new link)))) :custom (git-link-use-commit t) :bind ("C-c g s" . git-link) |