bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#47012: xref copies keymap properties to minibuffer


From: Dmitry Gutov
Subject: bug#47012: xref copies keymap properties to minibuffer
Date: Thu, 1 Apr 2021 17:13:52 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

On 01.04.2021 11:43, Juri Linkov wrote:

https://altbox.dev/ack/screenshot.png
https://spinorlab.wordpress.com/2015/08/15/the-silver-searcher/

But all of them display green foreground file names
with yellow background matches.  This is exactly
what grep.el does by default, so it's the reason
why output of grep.el is readable, but output of xref.el is not.

3/4 use something yellow-ish, yes (ripgrep in the console uses red foreground, for some reason).

The problem is that currently in xref both file names and matches
use the same color green.  The only difference is that file names
are displayed with green foreground, and matches with green background.

Okay. Guess I haven't experienced that because in my theme highlight looks grey-ish. *sigh*

What causes the difficulty in readability is the effect similar to
https://en.wikipedia.org/wiki/Stroop_effect that causes the
delay in reaction time between congruent and incongruent stimuli.

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".

ag and deadgrep use some darker khaki tones on the screenshots, but both probably assume dark background.

Another suggestion how to remove "visual garbage" is to truncate
duplicate prefixes: currently the prefixes of long absolute file names
are repeated for all file names.  It would improve readability
to display shorter relative file names without duplicate project root part.

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.

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.

Not sure the logic is applicable to general xref output, though (e.g. xref-find-definitions search in a directory with TAGS but without .git). So perhaps that behavior should be opt-in, e.g. with an extra arg for xref--show-xrefs.

Or just keep it an exception, hoping people don't use 'C-u C-x p g' outside of projects often enough for this to be a nuisance.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]