The question is unclear. What identifier do you want it to find the definition of?
By default it uses the identifier at point - and it doesn't prompt you.
If there's no identifier at point, it prompts you.
(To be more precise, it depends on the current command. If (xref--prompt-p this-command)
returns non-nil
then it will also prompt you, even if there's an identifier at point. But (xref--prompt-p 'xref-find-definitions)
returns nil
.)
If you're being prompted, and you think there's an identifier at point, then provide a step-by-step recipe to repro, starting from emacs -Q
(no init file).
This is the sexp that's apparently prompting you:
(xref--read-identifier "Find definitions of: ")
And this is the definition of that function:
(defun xref--read-identifier (prompt)
"Return the identifier at point or read it from the minibuffer."
(let* ((backend (xref-find-backend))
(id (xref-backend-identifier-at-point backend)))
(cond ((or current-prefix-arg
(not id)
(xref--prompt-p this-command))
(completing-read (if id
(format "%s (default %s): "
(substring prompt 0 (string-match
"[ :]+\\'" prompt))
id)
prompt)
(xref-backend-identifier-completion-table backend)
nil nil nil
'xref--read-identifier-history id))
(t id))))
You can see that it shouldn't prompt, in the conditions I described. You can also use M-x debug-on-entry xref--read-identifier
to see exactly why it's prompting you, if it is.