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.

1
  • 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
    Commented May 16, 2019 at 14:08

1 Answer 1

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: "))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.