An existing*xref* buffer doesn't have its default-directory changed
when running project-find-regexp. Since project-find-regexp switches to
*xref*, that means running project-find-regexp twice in a row may search
two different projects, which is unexpected.
Steps to reproduce:
With buffers in two different projects as detected by project.el, do the
following sequence:
1. Switch to a buffer in project A
2. project-find-regexp, which will search project A, and create and
switch to an*xref* buffer with a default-directory pointing at the
project root of A
3. project-find-regexp again, which will search project A again. (This
is the desired behavior)
4. Switch to a buffer in project B
5. project-find-regexp, which will search project B and switch to the
existing*xref* buffer (which is still pointing at project A)
6. project-find-regexp again, which will search project A instead of B.
Suggested fix:
Change project-find-regexp to reset the default-directory of the*xref*
buffer used to the most recently used project root.