3

I want to call xref-find-definitions from within my own lisp code and I'm struggling.

(xref-find-definitions IDENTIFIER)

Find the definition of the identifier at point.

It wants a parameter but I don't understand what parameter to supply because if I call it directly it just reads the name of a function from (point) and finds the source code for me.

As background, I maintain a private mark-ring with functions to (un)rotate-and-go and I want to combine go-to-source-of-function-named-at-point and push-point-onto-private-mark-ring as one key-combination.

I'm aware of bury-buffer and wrote my own unbury-buffer.

Stefan
  • 26,154
  • 3
  • 46
  • 84
  • 1
    Please consider filing a bug report: `M-x report-emacs-bug`. The doc for a function (doc string or manual) should describe each of its parameters. It should be clear enough that a user can understand how to call/use the function. – Drew May 16 '19 at 14:08

1 Answers1

3

You can call xref-find-definitions programatically by

(xref-find-definitions (symbol-name (symbol-at-point)))

or if you want to be prompted for an identifier

(funcall-interactively #'xref-find-definitions (xref--read-identifier "Find definitions of: "))
Kevin
  • 76
  • 5