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: Sat, 3 Apr 2021 02:23:43 +0300 Message-ID: <303d1e84-166a-a49a-817f-c83d11e371e5@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> <4d3edf81-97d8-4e0e-51c0-7b2d71b57889@yandex.ru> <87o8exsv1p.fsf@mail.linkov.net> <2da88387-25ad-c615-922d-718e1b7a49d1@yandex.ru> <87lfa1nvkn.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24142"; 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 Sat Apr 03 01:24:10 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 1lST98-000699-Gp for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 03 Apr 2021 01:24:10 +0200 Original-Received: from localhost ([::1]:47582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lST97-000065-0q for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Apr 2021 19:24:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lST90-00005w-T1 for bug-gnu-emacs@gnu.org; Fri, 02 Apr 2021 19:24:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49696) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lST90-00057L-Lg for bug-gnu-emacs@gnu.org; Fri, 02 Apr 2021 19:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lST90-0007Cx-HA for bug-gnu-emacs@gnu.org; Fri, 02 Apr 2021 19:24: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: Fri, 02 Apr 2021 23:24: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.161740583527695 (code B ref 47012); Fri, 02 Apr 2021 23:24:02 +0000 Original-Received: (at 47012) by debbugs.gnu.org; 2 Apr 2021 23:23:55 +0000 Original-Received: from localhost ([127.0.0.1]:33009 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lST8s-0007Cc-R1 for submit@debbugs.gnu.org; Fri, 02 Apr 2021 19:23:55 -0400 Original-Received: from mail-wr1-f49.google.com ([209.85.221.49]:46960) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lST8q-0007CN-A3 for 47012@debbugs.gnu.org; Fri, 02 Apr 2021 19:23:52 -0400 Original-Received: by mail-wr1-f49.google.com with SMTP id v4so5821731wrp.13 for <47012@debbugs.gnu.org>; Fri, 02 Apr 2021 16:23:52 -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=P4D/rE+34usyrK6nczG7zwCmktbiifyvIvPBVX0WY9A=; b=lPzdkIm3KNJ1K+bbSG9wlPGjyo+qg7LkL4VInX1+pFtNGEZevxMUDBgJ2IuooPqUtJ k1p3ZT+MqLz0tzH3PvRPELmgbI3ScjwaI3Sdh3enjVT9WxMPgsDUvvKHCwDsbI8jJGU/ zr2B3dZIcj94Xb8A/XJrkv+r7pGDOYVP5vYi45NfWfgWmbcmMLxQRUQHpounUICwa/0/ UqXlpvTVZivz0xRPtEqWeqIeuoFPK7jLM0fXHOCsTncl4nTDiNiiXAXFUz5mewBNHVeD het5cPq67NUbZNXSubcCOMmietzOOfIVDyl4Bfvaj9gvPq1niS9ZzXqT6Uubfb7hm7OZ 4nPQ== 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=P4D/rE+34usyrK6nczG7zwCmktbiifyvIvPBVX0WY9A=; b=IlzrRWz+LGSzOe/ua27+ymzCuw54cuO/OAdNzDU8tTmkscH6NYnpvqv5tKeXqBMgnM cTQl2xiFHFeKTRQIn2bgdZyHsMuNjEAuPTwjLaFk8mcFqJoT4GFY05oLzbv9DG/yBjhS XZOpYIYzmuc9V7GTsae7mzKYrx5qUyJpDKvuIIoCjMqehczcX+n+6TmUsbxAQbxoe1+3 a0xWylfezWSUHy8MIk3V+xqYHfSSk9irZrHpweesmu2OPR13GZUQ83rCzBKZAgaWddhA YezYZT8Hy8z+xDVFtHkJLAJOsogS1ktvM5XY7qJJKPmGvWrtQwpaiOtSjOy35GRAB77R UhiQ== X-Gm-Message-State: AOAM530K/vEnHMsAWCZ2MXBb/8u9Erk3CTvBlM2ewDX8jc2mci0d5pqA knHIeYJYLZz+BgtKzqYQ6ZXtkPWTd0I= X-Google-Smtp-Source: ABdhPJw2K4d6vd5ZLB3G+HtH1Co/u5KPVkXbOTfuIslOqCxCAAVohGkRSaT1bATRGLsJSzi3su451g== X-Received: by 2002:a5d:570c:: with SMTP id a12mr17599441wrv.209.1617405826361; Fri, 02 Apr 2021 16:23:46 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id 1sm36107404wmj.0.2021.04.02.16.23.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Apr 2021 16:23:45 -0700 (PDT) In-Reply-To: <87lfa1nvkn.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:203480 Archived-At: On 02.04.2021 11:25, Juri Linkov wrote: >>>>>> 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. >> >> LGTM. > > Pushed now. Thanks. >> That's not so easy to do: the exact command is concealed inside the helper >> function in another package (xref). I suppose it's possible to rearrange >> things such that command creation and its execution are two different >> phases, but TBH I wouldn't love the result. Though I agree it might >> be handy. > > This is the simplest implementation: > > #+begin_src emacs-lisp > (defun project-find-word (regexp) > "Word-based version of ‘project-find-regexp’. > Modifies the ‘xref-search-program-alist’ template > to add the option ‘-w’ that matches whole words." > (interactive (list (project--read-regexp))) > (let ((xref-search-program-alist > (mapcar (lambda (p) > (cons (car p) (replace-regexp-in-string "" "-w \\&" (cdr p)))) > xref-search-program-alist))) > (project-find-regexp regexp))) > #+end_src Wouldn't it work the same if you instead modify the regexp to be surrounded with \b...\b? > It has one minor issue: > while it correctly filters out lines without word matches, > when a line with a word match contains also the same string > that is not a complete word, then both are highlighted as matches. > There is no such problem in grep where matches are highlighted > by the grep program itself. > > BTW, the above implementation was based on a similar command for rgrep: If you use the above suggestion, it should fix highlighting as well. >> To sum up, if we managed to create some visual interface for specifying the >> options that project-find-regexp has control over, maybe it would both >> result in a less complex interaction between packages, as well as in a more >> powerful UI which more people will be happy with. > > Sounds like a widget-based form-filling with fields. Actually, such fields > already exist in xref-search-program-alist template with placeholders > , , , , that are expanded by grep-expand-template. As you can see, there are only two fields in the actual entries there. But we want to be able to modify more parameters. In the spirit of Emacs, it should more keyboard-driven than, say, Customize widgets. I don't have the full workflow in mind yet, but it could use the same separator as query-replace history, only with more complex completion logic.