Created
September 29, 2020 14:30
-
-
Save rossabaker/00e44a811c2021054bc4789c5d6837f7 to your computer and use it in GitHub Desktop.
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 ross/xref-find-definitions-etags-fallback (identifier) | |
"Find the definition of the identifier at point. | |
With prefix argument or when there's no identifier at point, | |
prompt for it. | |
If the primary xref-backend fails, fall back to the etags backend." | |
(interactive (list (xref--read-identifier "Find definitions of: "))) | |
(condition-case nil | |
(xref-find-definitions identifier) | |
(user-error | |
(let ((xref-backend-functions '(etags--xref-backend t))) | |
(xref--find-definitions identifier nil))))) | |
;; Without this, we get an interactive prompt | |
(add-to-list 'xref-prompt-for-identifier 'ross/xref-find-definitions-etags-fallback t) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment