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?

anon2328
  • 71
  • 5
  • 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 01 '22 at 23:21

1 Answers1

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.

anon2328
  • 71
  • 5