From: Juri Linkov <juri@linkov.net>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 47012@debbugs.gnu.org
Subject: bug#47012: xref copies keymap properties to minibuffer
Date: Thu, 01 Apr 2021 21:45:38 +0300 [thread overview]
Message-ID: <87o8exsv1p.fsf@mail.linkov.net> (raw)
In-Reply-To: <4d3edf81-97d8-4e0e-51c0-7b2d71b57889@yandex.ru> (Dmitry Gutov's message of "Thu, 1 Apr 2021 17:13:52 +0300")
[-- Attachment #1: Type: text/plain, Size: 2810 bytes --]
>> 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'.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: match.patch --]
[-- Type: text/x-diff, Size: 1196 bytes --]
diff --git a/lisp/replace.el b/lisp/replace.el
index f131d263ec..07b2d59a25 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1433,7 +1433,7 @@ occur-next-error
\f
(defface match
'((((class color) (min-colors 88) (background light))
- :background "yellow1")
+ :background "#ffff66")
(((class color) (min-colors 88) (background dark))
:background "RoyalBlue3")
(((class color) (min-colors 8) (background light))
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index ea52befec5..cada1f1109 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -103,7 +103,7 @@ xref-match-length
;;;; Commonly needed location classes are defined here:
-(defcustom xref-file-name-display 'abs
+(defcustom xref-file-name-display 'project-relative
"Style of file name display in *xref* buffers.
If the value is the symbol `abs', the default, show the file names
@@ -521,7 +521,7 @@ xref-line-number
"Face for displaying line numbers in the xref buffer."
:version "27.1")
-(defface xref-match '((t :inherit highlight))
+(defface xref-match '((t :inherit match))
"Face used to highlight matches in the xref buffer."
:version "27.1")
next prev parent reply other threads:[~2021-04-01 18:45 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-08 20:03 bug#47012: xref copies keymap properties to minibuffer Juri Linkov
2021-03-09 2:08 ` Dmitry Gutov
2021-03-11 20:58 ` Juri Linkov
2021-03-24 20:38 ` Juri Linkov
2021-03-24 21:57 ` Dmitry Gutov
2021-03-25 9:40 ` Juri Linkov
2021-03-25 10:57 ` Dmitry Gutov
2021-03-25 21:28 ` Juri Linkov
2021-03-25 22:12 ` Dmitry Gutov
2021-03-30 19:16 ` Juri Linkov
2021-03-31 15:47 ` Dmitry Gutov
2021-03-31 15:59 ` Eli Zaretskii
2021-03-31 16:10 ` Dmitry Gutov
2021-03-31 16:57 ` Eli Zaretskii
2021-04-01 0:25 ` Dmitry Gutov
2021-04-01 7:17 ` Eli Zaretskii
2021-03-31 17:05 ` Juri Linkov
2021-04-01 1:16 ` Dmitry Gutov
2021-04-01 8:43 ` Juri Linkov
2021-04-01 14:13 ` Dmitry Gutov
2021-04-01 18:45 ` Juri Linkov [this message]
2021-04-01 19:06 ` Eli Zaretskii
2021-04-01 21:28 ` Dmitry Gutov
2021-04-02 6:08 ` Eli Zaretskii
2021-04-02 23:50 ` Dmitry Gutov
2021-04-03 7:24 ` Eli Zaretskii
2021-04-03 18:12 ` Dmitry Gutov
2021-04-03 18:19 ` Eli Zaretskii
2021-04-02 8:20 ` Juri Linkov
2021-04-01 22:43 ` Dmitry Gutov
2021-04-02 8:25 ` Juri Linkov
2021-04-02 23:23 ` Dmitry Gutov
2021-04-04 22:55 ` Juri Linkov
2021-04-05 2:15 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o8exsv1p.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=47012@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).