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#49731: 28.0.50; Filter xref results by filename Date: Mon, 2 Aug 2021 05:09:30 +0300 Message-ID: <54489bae-ec24-43e7-a600-7189cad19bb5@yandex.ru> References: <030dbe6c-130d-e578-f50d-54e90bfa7cfa@yandex.ru> <7593e0f3-9399-ccf3-21de-b2ac79ae3730@yandex.ru> <87fsvyik4u.fsf@mail.linkov.net> <87tukdm4bn.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="1489"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 Cc: Daniel =?UTF-8?Q?Mart=C3=ADn?= , 49731@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 02 04:10:16 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 1mANPD-0000D8-3U for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 02 Aug 2021 04:10:15 +0200 Original-Received: from localhost ([::1]:34450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mANPB-0006LR-Mf for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 Aug 2021 22:10:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54078) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mANP0-0006LE-84 for bug-gnu-emacs@gnu.org; Sun, 01 Aug 2021 22:10:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53950) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mANP0-0002az-0f for bug-gnu-emacs@gnu.org; Sun, 01 Aug 2021 22:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mANOz-0006vL-Q6 for bug-gnu-emacs@gnu.org; Sun, 01 Aug 2021 22:10:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Aug 2021 02:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49731 X-GNU-PR-Package: emacs Original-Received: via spool by 49731-submit@debbugs.gnu.org id=B49731.162787018226586 (code B ref 49731); Mon, 02 Aug 2021 02:10:01 +0000 Original-Received: (at 49731) by debbugs.gnu.org; 2 Aug 2021 02:09:42 +0000 Original-Received: from localhost ([127.0.0.1]:37263 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mANOf-0006uh-I3 for submit@debbugs.gnu.org; Sun, 01 Aug 2021 22:09:41 -0400 Original-Received: from mail-wr1-f41.google.com ([209.85.221.41]:37655) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mANOc-0006uT-HW for 49731@debbugs.gnu.org; Sun, 01 Aug 2021 22:09:40 -0400 Original-Received: by mail-wr1-f41.google.com with SMTP id d8so19556799wrm.4 for <49731@debbugs.gnu.org>; Sun, 01 Aug 2021 19:09:38 -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=RhT9uAFdtr2Yd7Gjlrr5SRvdc+60TUjNBe4oypx5/AA=; b=e2Q//gvinklt1pzGdPhyB4vKjj/zsFdoWxzOakIyVEFAIKbTjMM7IWhGyN6gBEoNb3 afU3d38mqswnr7/nLO2L9DntK62ImcUOkpBjMjsoN8wnPAzrGR/gxHW0/eXQJNHlX+Bp HW3HFzlQD+N1MJRvrgvQ1dDUyAGOR2O/z5zeI9I2oEkisO6fPPX7BtOxwdEG2NuMohPC /BFonxY0YxqbFwxUCuHalL9z8YXio7RvAjgBd63vCuwyCPoQw9+xGVau4W05WXButujQ gEPKYAWPnvu0lkypbw1+kWFKE2jOcY8sJIEt6ScG2MCpVtPugseJRyguhILVOHeWznQe yVOw== 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=RhT9uAFdtr2Yd7Gjlrr5SRvdc+60TUjNBe4oypx5/AA=; b=mUmDt0GQ+GEBiZ7yo43Clxek0zjV5E32y4jW0HEjhjF8X+aURutrI6fTLH4M0O3WfW 7zCSEWzuYSNJtv/K6bQ0vtGLxRtL3vEJOYbJ6n8HAmBKMYjuvkwtSxZltGofjTvI9Y7a rJS6hbz6FgEO1HwQXa0uBBuuQxzPCJRaNP93WN23gp+iIG4ZSFpUgGCnFbOuoa8sDdhw dXsEjPxBt5KQ2qXqbAyoXyutpXskYuvyqbuVtgdwrlV19ubdgyHS4DglSXw1FYNBXuOl ZIy+mwoPcBT7/Twv5embEa2VirsDGktbWex5Vg5o/kZxtnVwbVW0udnN+6fzLJbJPi/5 Z2sw== X-Gm-Message-State: AOAM532f1AxEyf2hcFblXlo7o5AB6bJHv1+LKrzNTifL+yTpH4IDdB3w 7ukzizNsSIbD6Bt3bVol2Om/cVwrIYs= X-Google-Smtp-Source: ABdhPJyOcKX7iILsrleeqWAzACzBebH6JwniErHL/r0aLwcjD6Q75B84RWPMnm5ytUA/aE20Ex05Kg== X-Received: by 2002:adf:d1e4:: with SMTP id g4mr1565357wrd.371.1627870172643; Sun, 01 Aug 2021 19:09:32 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id d7sm3055762wrs.39.2021.08.01.19.09.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 Aug 2021 19:09:31 -0700 (PDT) In-Reply-To: <87tukdm4bn.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:211056 Archived-At: On 29.07.2021 20:43, Juri Linkov wrote: >>> 1. while xref-find-references works fine in `emacs -Q`, >>> I don't know why with my customization typing e.g. >>> 'M-? isearch-lazy-highlight RET' reports >>> "No references found for: isearch-lazy-highlight". >> >> Try and see which of the "tools" semantic-symref-perform-search ends >> up using. > > Thanks for the pointers to semantic-symref-perform-search. > It prepends "-n " to my customized pattern "rg -nH", > so the arg "-n" is duplicated on the command line: > > `rg -n -nH` > > and signals the error: > > error: The argument '--line-number' was provided more than once, but cannot be used multiple times > > This error is caused by the bug in the command line parser used by ripgrep: > > https://github.com/clap-rs/clap/issues/2171 > > that was fixed only 6 months ago, so it will take much time > before this fix will reach ripgrep, and this bug will be closed: > > https://github.com/BurntSushi/ripgrep/issues/1701 The above might be worked around with creating a symref-grep specific user option for grep-find-template which would default to the "global" value of that variable. > But even without duplicated "-n" semantic-symref-perform-search > doesn't work with ripgrep because it doesn't find such pattern: > > \\\\\\(\\^\\\\\\|\\\\W\\\\\\)isearch-lazy-highlight\\\\\\(\\\\W\\\\\\|\\$\\\\\\) > > Maybe semantic-symref-perform-search could be improved to support ripgrep? > Because without these two problems it works fine with ripgrep. ...but the above tells us (I think) that semantic-symref-perform-search is trying to use the basic regexp syntax, and ripgrep doesn't support that (only Extended, or PCRE). For your personal consumption, perhaps the best approach is to create a separate "tool", like Grep (by copying symref/grep.el and tweaking some of its definitions), and then register it in semantic-symref-tool-alist. I don't know if ripgrep is that much faster for this particular purpose. So maybe it's too much work for little benefit. >>> 2. xref-find-apropos doesn't offer the identifier at point as its >>> default, and after using it e.g. from the buffer isearch.el with >>> 'C-M-. isearch-lazy-highlight RET' all its lines are concatenated >>> on the same line in `emacs -Q`: >> >> Thanks for the report, should be fixed now. > > I confirm it's fixed, thanks. I suppose xref-find-apropos doesn't offer > the identifier at point as its default because 'apropos' doesn't offer > the default? But this is not a big problem. Maybe because of that, or because one usually searches for a word or several (right?), rather than some identifier name. Providing a default wouldn't break anything, though. Perhaps some people will find it easier to extract the key words they wanted from the symbol name at point. Try this patch: diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index b7a926f82e..4b73f3715a 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1353,7 +1353,9 @@ xref-find-apropos The argument has the same meaning as in `apropos'." (interactive (list (read-string "Search for pattern (word list or regexp): " - nil 'xref--read-pattern-history))) + nil 'xref--read-pattern-history + (xref-backend-identifier-at-point + (xref-find-backend))))) (require 'apropos) (let* ((newpat (if (and (version< emacs-version "28.0.50")