feature/lookup: fix lookup commands skipping to project text search

This commit is contained in:
Henrik Lissner 2018-04-23 01:19:26 -04:00
parent cf99f29ee0
commit 7579110534
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 16 additions and 5 deletions

View file

@ -25,9 +25,10 @@
((xref-backend-identifier-at-point (xref-find-backend)))))
(defun +lookup--jump-to (prop identifier)
(cl-loop for fn in (plist-get '(:definition +lookup-definition-functions
:references +lookup-references-functions
:documentation +lookup-documentation-functions)
(cl-loop with origin = (point-marker)
for fn in (plist-get (list :definition +lookup-definition-functions
:references +lookup-references-functions
:documentation +lookup-documentation-functions)
prop)
for fn = (or (command-remapping fn) fn)
if (condition-case e
@ -38,6 +39,16 @@
('error (ignore (message "%s" e))))
return it))
;;;###autoload
(defun +lookup-xref-definitions (identifier)
"Non-interactive wrapper for `xref-find-definitions'"
(xref-find-definitions identifier))
;;;###autoload
(defun +lookup-xref-references (identifier)
"Non-interactive wrapper for `xref-find-references'"
(xref-find-references identifier))
;;
;; Main commands

View file

@ -33,12 +33,12 @@ produces an url. Used by `+lookup/online'.")
(defvar +lookup-open-url-fn #'browse-url
"Function to use to open search urls.")
(defvar +lookup-definition-functions '(xref-find-definitions)
(defvar +lookup-definition-functions '(+lookup-xref-definitions)
"Functions for `+lookup/definition' to try, before resorting to `dumb-jump'.
Stops at the first function to return non-nil or change the current
window/point.")
(defvar +lookup-references-functions '(xref-find-references)
(defvar +lookup-references-functions '(+lookup-xref-references)
"Functions for `+lookup/references' to try, before resorting to `dumb-jump'.
Stops at the first function to return non-nil or change the current
window/point.")