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 04:16:08 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

On 31.03.2021 20:05, Juri Linkov wrote:
   -(defface xref-file-header '((t :inherit compilation-info))
+(defface xref-file-header '((t :background "grey90" :extend t))
     "Face used to highlight file header in the xref buffer."
     :version "27.1")
#+end_src

I'm not sure I like the result. Simply applying your change to the face
results in a color-less buffer with grey spots for both file headers and

It's good that the buffer is color-less since this improves readability
because in such cases colors add distraction.

But colors add emphasis as well, don't they? If something is written in a different color, that makes it stand out. Use too many colors - we get into the "angry fruit said" territory, but use too few, and you're leaving some tools on the table.

match highlights (at least, with my current theme).

Indeed, it adds grey lines for file headers, but there are
no grey lines for match highlights by default.

Fair point, I've tried your proposal again with the default theme.

Highlighting color is not grey, so there's less of that color-less impression. The headers still get uncomfortably dark, kinda lifeless. I don't get the same impression in diff-mode buffers.

And in diff-mode buffers there is a lot of grey background near and around the file names already. So making their background a darker grey doesn't take away much from readability while providing the needed emphasis. And the color green is not an option there.

It's less of a problem with diff-mode because its basic background is
grey already.

The proposed change is for the default theme.
If the proposed change doesn't fit your personal theme customization,
this is fine.  At least, please mention in the docstring a suggestion
how the users could improve the readability of this face.

The above is a comparison with another core package.

I'm fairly sure your suggestion is not going to improve readability, though it certainly does make lines with file names stand out more.

A carefully worded recommendation wouldn't hurt, but I wonder what would be the best place for it.

Then I've tried to see what others do, for instance
https://github.com/Wilfred/deadgrep, which I'd heard people praise
usability of.

The only distinction it adds to file names is "bold :t". And diff-mode also
does that, actually.

So... how do you like this simple change?

(defface xref-file-header '((t :bold t :inherit compilation-info))
   "Face used to highlight file header in the xref buffer."
   :version "27.1")

This is exactly what I used as customization for a long time,
and it was a pain with so much of "visual garbage", until I realized
there is the existing solution in diff-mode faces.

The above was actually a mistake on my part, because the default theme already puts ':bold t' on the 'success' face, which is in turn inherited by 'compilation-info' and 'xref-file-header'. Thus my suggestion was a no-op.

Could you elaborate on the "visual garbage" part? If you mean the use of colors, then the default theme is not too shy about having bright colors. So at least that is consistent with other looks.

It seems you're inclined to keep the green color because this is what
is used in grep, right?  But in grep, the green color on file names
doesn't add distraction because file names are located on the left,
whereas matches are on the right part of the output.  But in xref output
lines with file names and lines with matches are interlaced.

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/

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





reply via email to

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