Skip to content

Instantly share code, notes, and snippets.

@chmouel
Created October 22, 2023 19:58
Show Gist options
  • Save chmouel/4d3d551a7cce2e5e679eabcb06800f06 to your computer and use it in GitHub Desktop.
Save chmouel/4d3d551a7cce2e5e679eabcb06800f06 to your computer and use it in GitHub Desktop.
Magit log trace definition using TS for function name
(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