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: Juri Linkov
Subject: bug#47012: xref copies keymap properties to minibuffer
Date: Thu, 01 Apr 2021 11:43:40 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

> But it does create an analogy with Grep, which is one of the main places
> where we're used to seeing file names in a list. Thus looking at the green
> color we're likely to make a connection and see that this line shows
> a file name.
>
> I'm not as much beholden to this color exactly, as to the idea of using
> *some* color for this purpose. And I don't know of better prior art.
>
> Regarding file names on the left, Grep does that, but look at ripgrep in
> the console, or the deadgrep Emacs package. Neither add any extra
> decorations to the line except emphasizing it with a different color
> (admittedly not green in these two cases) and (maybe) bold font weight.
>
> Or look at ack or SilverSearcher, which both use green for file names,
> while using the same grouping layout that we do (they had been an
> inspiration, even though we've inherited the xref UI from SLIME):
>
> 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.

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.

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.

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





reply via email to

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