From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#47012: xref copies keymap properties to minibuffer Date: Thu, 1 Apr 2021 17:13:52 +0300 Message-ID: <4d3edf81-97d8-4e0e-51c0-7b2d71b57889@yandex.ru> References: <87czw9tnu9.fsf@mail.linkov.net> <3aad442a-7319-5db5-2fc6-560bb032c34d@yandex.ru> <87a6r9v24b.fsf@mail.linkov.net> <87sg4kb839.fsf@mail.linkov.net> <871rc3bls6.fsf@mail.linkov.net> <871rc2ly7x.fsf@mail.linkov.net> <4228b128-039c-2bcd-002c-5ac830d7a4d3@yandex.ru> <87pmzgtr80.fsf@mail.linkov.net> <186b46fa-3716-a76d-db85-09638d7805c7@yandex.ru> <87v99745jj.fsf@mail.linkov.net> <87zgyiv03f.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7219"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 Cc: 47012@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 01 16:15:17 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lRy6O-0001k2-Uk for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 01 Apr 2021 16:15:17 +0200 Original-Received: from localhost ([::1]:38910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lRy6N-0007Gc-T9 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 01 Apr 2021 10:15:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54346) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRy6B-0007GV-Oi for bug-gnu-emacs@gnu.org; Thu, 01 Apr 2021 10:15:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46602) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lRy6A-0007Mw-70 for bug-gnu-emacs@gnu.org; Thu, 01 Apr 2021 10:15:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lRy6A-0007fe-20 for bug-gnu-emacs@gnu.org; Thu, 01 Apr 2021 10:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 01 Apr 2021 14:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47012 X-GNU-PR-Package: emacs Original-Received: via spool by 47012-submit@debbugs.gnu.org id=B47012.161728644329405 (code B ref 47012); Thu, 01 Apr 2021 14:15:02 +0000 Original-Received: (at 47012) by debbugs.gnu.org; 1 Apr 2021 14:14:03 +0000 Original-Received: from localhost ([127.0.0.1]:58148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lRy5C-0007eC-Nv for submit@debbugs.gnu.org; Thu, 01 Apr 2021 10:14:03 -0400 Original-Received: from mail-ej1-f42.google.com ([209.85.218.42]:36690) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lRy5A-0007dZ-Km for 47012@debbugs.gnu.org; Thu, 01 Apr 2021 10:14:01 -0400 Original-Received: by mail-ej1-f42.google.com with SMTP id a7so3129450ejs.3 for <47012@debbugs.gnu.org>; Thu, 01 Apr 2021 07:14:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=RoPksYXIpL919jz0AmCzwFALa9MMGs7xIPJi9sDsymA=; b=YONl9R4PQNs27W+3I0TZzqpLPdzSOK86yqeXZs3wB6JVUTjvuiO+QXknzEZWRxTClF mh8xZy62quIs8HFbShkOxsx41DOTke8z2A6EWywXkDSLp3s88DR4pCyGShJecRlzJCMO F5RFl2Nawtqmv7ifcoZKLcUNNkfFwOBdapDwRWITM7bDCpRuA0cWrYHTzSFn5mEkQz+m DwIXru6bDBdQNqRFLjnvFF47EyEPj1ILLn+izUUISOPXs47kaHSPgRPuyF1Pdedzosv7 Q1ycif/HMl100qTsUsfkxSpjMMbl5zsPPONi819XpMPuG/ntZOxbUG+Y57+ru15qfLsp tI3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=RoPksYXIpL919jz0AmCzwFALa9MMGs7xIPJi9sDsymA=; b=WMzSIJKSySQbUafB2zUhnwsUAapM9aboy4zSBOenR5M7q2sxaOgL1Vpa4xviG06WdP EkqW21zsL7AvGNTisRf3ZNHTzwark9GxLP2oJK6M5kOXGP0LlO2Yf60UwVFTy8RV2af9 o/eHq1aDtL2G18ir9zQqiOGExUa9vJrGljr1kO8oCug6z56W1FhgTi8fko10bjseKx9V qlwW8VO9WYxuNm4304tMObVIp8S7SNJiVwvNBOSbwSWrFPWpm3SQ/scI8RuwIGwe8jqk KxyZIcDTR/RWZRUZjVErcZATHH9Mam6pybCGPfUk3bE7H0ubkL9eJI8SCHJjBPzBwbJv YGYQ== X-Gm-Message-State: AOAM533d+hE7B3HO7Ck+kqau7O8ak2y0C791bpkRVMiBBfCYUmA9fCTF pHK4tvLPVhwub4XXdwcl7RccTNadvSc= X-Google-Smtp-Source: ABdhPJww7DdjGKewq7KwKvhpf9NIv+aZd7h7BeN/EfOMqp22VEo3uEvuPi6yCqvmu4TEfVn48KSeyA== X-Received: by 2002:a17:906:a155:: with SMTP id bu21mr9299246ejb.400.1617286434821; Thu, 01 Apr 2021 07:13:54 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id r19sm2785661ejr.55.2021.04.01.07.13.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Apr 2021 07:13:54 -0700 (PDT) In-Reply-To: <87zgyiv03f.fsf@mail.linkov.net> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:203425 Archived-At: 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.