diff options
author | David Morgan <djm_uk@protonmail.com> | 2024-10-01 15:53:10 +0100 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2024-10-01 15:53:10 +0100 |
commit | 43bd950c674a11d285084e5d7da2c63ba899c724 (patch) | |
tree | a8d90757c7dc880aad6cfb0efbcb63732cea2149 /.emacs.d | |
parent | f215cfc179a4284639fb6d57f0f3a88c7158dde2 (diff) | |
download | dotfiles-43bd950c674a11d285084e5d7da2c63ba899c724.tar.gz |
Add function to find references to the current defun
Diffstat (limited to '.emacs.d')
-rw-r--r-- | .emacs.d/lisp/init-editor.el | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/.emacs.d/lisp/init-editor.el b/.emacs.d/lisp/init-editor.el index 925b05d..850ddab 100644 --- a/.emacs.d/lisp/init-editor.el +++ b/.emacs.d/lisp/init-editor.el @@ -172,6 +172,11 @@ :ensure `(xref :build ,(+elpaca-xref-build-steps)) :custom (xref-search-program 'ripgrep) :config + (defun xref-find-references-current-defun () + "`xref-find-references' for the enclosing defun." + (interactive) + (xref-backend-identifier-completion-table (xref-find-backend)) + (xref-find-references (which-function))) (defun xref-find-references-other-window (identifier) "Like `xref-find-references' but switch to the other window." (interactive (list (xref--read-identifier "Find references of: "))) @@ -187,7 +192,8 @@ ;; there is no value at point that can be used (add-to-list 'xref-prompt-for-identifier 'xref-find-references t) (add-to-list 'xref-prompt-for-identifier 'xref-find-references-other-window t) - (add-to-list 'xref-prompt-for-identifier 'xref-find-references-other-frame t)) + (add-to-list 'xref-prompt-for-identifier 'xref-find-references-other-frame t) + :bind ("C-c q" . xref-find-references-current-defun)) (use-package ws-butler :diminish |