Function: xref-find-by-kind

xref-find-by-kind is an autoloaded, interactive and byte-compiled function defined in xref.el.gz.

Signature

(xref-find-by-kind IDENTIFIER KIND)

Documentation

Find some certain kind of definitions of the identifier at point.

Prompt for KIND to search for. With prefix argument or when there's no identifier at point, prompt for the identifier too.

If only one location is found, display it in the selected window. Otherwise, display the list of the possible definitions in a buffer where the user can select from the list.

Use M-, (xref-go-back) to return back to where you invoked this command.

When called programmatically, KIND should be one of supported symbols.

View in manual

Probably introduced at or before Emacs version 32.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/xref.el.gz
;;;###autoload
(defun xref-find-by-kind (identifier kind)
  "Find some certain kind of definitions of the identifier at point.

Prompt for KIND to search for.  With prefix argument or when there's no
identifier at point, prompt for the identifier too.

If only one location is found, display it in the selected window.
Otherwise, display the list of the possible definitions in a
buffer where the user can select from the list.

Use \\[xref-go-back] to return back to where you invoked this command.

When called programmatically, KIND should be one of supported symbols."
  (interactive (let* ((desc (xref--read-kind "Find by kind"))
                      (kind (plist-get desc :kind)))
                 (unless desc (user-error "Have to choose the kind"))
                 (list
                  (xref-read-identifier
                   (format-message (or (plist-get desc :prompt-format) "Find %s")
                                   (plist-get desc :name))
                   kind)
                  kind)))
  (let ((kind-desc (cl-find kind (xref-backend-xref-kinds (xref-find-backend))
                            :key (lambda (desc) (plist-get desc :kind)))))
    (xref--show-defs
     (xref--create-fetcher identifier 'xrefs-by-kind (plist-get kind-desc :name)
                           identifier (plist-get kind-desc :kind))
     nil)))