1

My daily workflow involves opening a number of diverse projects and navigating through them using Emacs. For some projects, xref-find-references requires me to select a project (with a "Select project:") prompt - as if it is unable to deduce the project root itself.

What is the reason for this seemingly random xref-find-references behavior and how can I fix it?

1
  • Can you specify an example a "some project"? Can you provide a recipe, starting with emacs -Q, to reproduce what you're seeing? That might help others help you.
    – Drew
    Oct 1, 2022 at 23:21

1 Answer 1

1

This happens when none of the directories up the path are git repositories (or other repositories of another source control system that your project package can recognize). Solution: navigate to what you consider the root of the project and run git init.

In more detail xref-find-references calls xref-backend-references, which invokes (project-current t) here. The project package attempts to decide what is the project root and if it cannot find files that indicate a git (or other source control repository), it interactively displays the "Select project: " prompt.

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.