Created
October 22, 2023 19:58
-
-
Save chmouel/4d3d551a7cce2e5e679eabcb06800f06 to your computer and use it in GitHub Desktop.
Magit log trace definition using TS for function name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun my-magit-log-trace-definition-ts() | |
(interactive) | |
(let ((funcname | |
(substring-no-properties | |
(treesit-node-text | |
(treesit-node-child-by-field-name (treesit-defun-at-point) "name"))))) | |
(magit-log-trace-definition (or (magit-file-relative-name) | |
(user-error "Buffer isn't visiting a file")) | |
(or funcname | |
(user-error "No function at point found")) | |
(or magit-buffer-refname | |
(magit-get-current-branch) | |
"HEAD")))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment