>> Using exactly the same grep colors in xref by changing >> 'xref-match' to inherit from the 'match' face >> completely solves this problem. > > You are right. I could even say "unfortunately", because IMHO the bright > yellow highlights are too much. Too strong emphasis, visually. > > So let's change it to inherit from 'match', because that's what that face > is documented to be used for. > > Additionally, what do you think about toning down 'match''s background > color? Maybe use some subtler yellow like "lemon chiffon" or "khaki1"? Or > "light goldenrod". Such toning down is welcome since currently match's background is too intense. Actually, I customized it long ago to "#ffff88" on one display, and to "#ffffbb" on another display. I guess "#ffffbb" is too radical, but "#ffff88" should be fine and close to "khaki1" that is nicely looking as well. Another variant is to update gradually, i.e. start with "#ffff66", then after some time to "#ffff88". >>> Please try (setq xref-file-name-display 'project-relative). >> Thanks, I didn't know about this. Shouldn't this be the default value >> since this is what's displayed by grep and ripgrep. > > I wouldn't mind, personally. This is added to the patch below too. >> Actually, there is no exact option for what grep and ripgrep do, >> because they display file names relative to the search directory. >> But currently there is no xref option to display file names >> relative to the subdirectory specified by 'C-u C-x p g'. > > This issue is tricky because xref-find-definitions does not assume the > presence of a project, or even of any kind of containing directory. And > yet, it's handy to show its results with relative file names when possible, > too. So I picked "relative to the project" as the option value, and the > corresponding logic. > > I think what you're talking about is only a problem when the directory has > no containing project at all. In that case we could probably default to the > value of default-directory as the reference. Maybe it would be nice to default to default-directory even when 'C-u C-x p g' is used in a project. What is the real problem for me is that after navigating to a project's subdirectory (with e.g. dired) and typing 'C-u C-x p g', it doesn't provide the current directory as the default value. It inserts the project root by default, not its subdirectory: Base directory: /project/root/ whereas 'M-x rgrep' conveniently provides default-directory as default. BTW, is it possible to make 'project-find-regexp' more compatible with 'rgrep' in other features too? What is missing is a way to modify the constructed command line. For example, often I need to add "-w" to the constructed command to match words only. In 'C-u M-x rgrep', this is easy to do, but not in 'C-u C-x p g'.