File: xref.el.html
This file provides a somewhat generic infrastructure for cross referencing commands, in particular "find-definition".
Some part of the functionality must be implemented in a language dependent way and that's done by defining an xref backend.
That consists of a constructor function, which should return a backend value, and a set of implementations for the generic functions:
xref-backend-identifier-at-point,
xref-backend-identifier-completion-table,
xref-backend-definitions, xref-backend-references,
xref-backend-apropos, which see.
A major mode would normally use add-hook to add the backend
constructor to xref-backend-functions.
The last three methods operate with "xref" and "location" values.
One would usually call xref-make and xref-make-file-location,
xref-make-buffer-location or xref-make-bogus-location to create
them. More generally, a location must be an instance of a type for
which methods xref-location-group and xref-location-marker are
implemented.
There's a special kind of xrefs we call "match xrefs", which
correspond to search results. For these values,
xref-match-length must be defined, and xref-location-marker
must return the beginning of the match.
Each identifier must be represented as a string. Implementers can
use string properties to store additional information about the
identifier, but they should keep in mind that values returned from
xref-backend-identifier-completion-table should still be
distinct, because the user can't see the properties when making the
choice.
Older versions of Xref used EIEIO for implementation of the
built-in types, and included a class called xref-location which
was supposed to be inherited from. Neither is true anymore.
See the etags and elisp-mode implementations for full examples.
Defined variables (33)
xref--current-item | Dynamically bound to the current item being processed. |
xref--fetcher | The original function to call to fetch the list of xrefs. |
xref--history | (BACKWARD-STACK . FORWARD-STACK) of markers to visited Xref locations. |
xref--original-window | The original window this xref buffer was created from. |
xref--original-window-intent | Original window-switching intent before xref buffer creation. |
xref--transient-buffer-mode-abbrev-table | Abbrev table for ‘xref--transient-buffer-mode’. |
xref--transient-buffer-mode-hook | Hook run after entering ‘xref--transient-buffer-mode’. |
xref--transient-buffer-mode-map | Keymap for ‘xref--transient-buffer-mode’. |
xref--transient-buffer-mode-syntax-table | Syntax table for ‘xref--transient-buffer-mode’. |
xref--xref-buffer-mode-abbrev-table | Abbrev table for ‘xref--xref-buffer-mode’. |
xref--xref-buffer-mode-hook | Hook run after entering ‘xref--xref-buffer-mode’. |
xref--xref-buffer-mode-map | Keymap for ‘xref--xref-buffer-mode’. |
xref--xref-buffer-mode-syntax-table | Syntax table for ‘xref--xref-buffer-mode’. |
xref-after-jump-hook | Functions called after jumping to an xref. |
xref-after-return-hook | Functions called after returning to a pre-jump location. |
xref-after-update-hook | Functions called after the xref buffer is updated. |
xref-auto-jump-to-first-definition | If t, ‘xref-find-definitions’ always jumps to the first result. |
xref-auto-jump-to-first-xref | If t, ‘xref-find-references’ always jumps to the first result. |
xref-backend-functions | Special hook to find the xref backend for the current context. |
xref-buffer-name | The name of the buffer to show xrefs. |
xref-current-item | Dynamically bound to the current item being processed. |
xref-etags-mode | Non-nil if Xref-Etags mode is enabled. |
xref-etags-mode-hook | Hook run after entering or leaving ‘xref-etags-mode’. |
xref-file-name-display | Style of file name display in *xref* buffers. |
xref-history-storage | Function that returns xref history. |
xref-marker-ring-length | Xref marker ring length. |
xref-num-matches-face | Face name to show the number of matches on the mode line. |
xref-prompt-for-identifier | If non-nil, prompt for the identifier to find. |
xref-search-program | The program to use for regexp search inside files. |
xref-search-program-alist | Association list mapping program identifiers to command templates. |
xref-show-definitions-function | Function to handle the definition search results. |
xref-show-xrefs-function | Function to display a list of search results. |
xref-truncation-width | The column to visually "truncate" each Xref buffer line to. |
Defined functions (164)
Defined faces (3)
xref-file-header | Face used to highlight file header in the xref buffer. |
xref-line-number | Face for displaying line numbers in the xref buffer. |
xref-match | Face used to highlight matches in the xref buffer. |