From 60c2e702e08585e979e5f6cbdb796cd5475abd34 Mon Sep 17 00:00:00 2001 From: Vasilij Schneidermann Date: Sun, 31 Dec 2017 17:45:31 +0100 Subject: Use xref-find-definitions if possible Closes #952 --- evil-commands.el | 17 +++++++++++------ evil-maps.el | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/evil-commands.el b/evil-commands.el index 4def324..2654f85 100644 --- a/evil-commands.el +++ b/evil-commands.el @@ -784,12 +784,17 @@ If called with a prefix argument, provide a prompt for specifying the tag." :jump t (interactive "P") - (if arg (call-interactively #'find-tag) - (let ((tag (funcall (or find-tag-default-function - (get major-mode 'find-tag-default-function) - #'find-tag-default)))) - (unless tag (user-error "No tag candidate found around point")) - (find-tag tag)))) + (cond + ((fboundp 'xref-find-definitions) + (let ((xref-prompt-for-identifier arg)) + (call-interactively #'xref-find-definitions))) + ((fboundp 'find-tag) + (if arg (call-interactively #'find-tag) + (let ((tag (funcall (or find-tag-default-function + (get major-mode 'find-tag-default-function) + #'find-tag-default)))) + (unless tag (user-error "No tag candidate found around point")) + (find-tag tag)))))) (evil-define-motion evil-lookup () "Look up the keyword at point. diff --git a/evil-maps.el b/evil-maps.el index 551cf2b..e4cdc3f 100644 --- a/evil-maps.el +++ b/evil-maps.el @@ -208,7 +208,7 @@ (define-key evil-motion-state-map "g^" 'evil-first-non-blank-of-visual-line) (define-key evil-motion-state-map "gm" 'evil-middle-of-visual-line) (define-key evil-motion-state-map "g$" 'evil-end-of-visual-line) -(define-key evil-motion-state-map "g\C-]" 'find-tag) +(define-key evil-motion-state-map "g\C-]" 'evil-jump-to-tag) (define-key evil-motion-state-map "{" 'evil-backward-paragraph) (define-key evil-motion-state-map "}" 'evil-forward-paragraph) (define-key evil-motion-state-map "#" 'evil-search-word-backward) -- cgit v1.0