unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Juri Linkov <juri@linkov.net>
Cc: "Daniel Martín" <mardani29@yahoo.es>, 49731@debbugs.gnu.org
Subject: bug#49731: 28.0.50; Filter xref results by filename
Date: Mon, 2 Aug 2021 05:09:30 +0300	[thread overview]
Message-ID: <54489bae-ec24-43e7-a600-7189cad19bb5@yandex.ru> (raw)
In-Reply-To: <87tukdm4bn.fsf@mail.linkov.net>

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





  reply	other threads:[~2021-08-02  2:09 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m1pmv6iz4n.fsf.ref@yahoo.es>
2021-07-25  8:19 ` bug#49731: 28.0.50; Filter xref results by filename Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-25  8:32   ` Lars Ingebrigtsen
2021-07-25  8:33     ` Lars Ingebrigtsen
2021-07-26 23:16       ` Dmitry Gutov
2021-07-25  9:10   ` Eli Zaretskii
2021-07-25 14:58     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-25 20:43   ` Juri Linkov
2021-07-26 11:49     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-26 22:53       ` Juri Linkov
2022-01-16 18:52       ` Juri Linkov
2022-11-21  7:58         ` Juri Linkov
2022-11-23  8:39           ` Juri Linkov
2022-11-23 14:19             ` Dmitry Gutov
2022-11-23 17:50               ` Juri Linkov
2022-11-23 18:08                 ` Dmitry Gutov
2022-11-23 18:20                   ` Juri Linkov
2022-11-23 18:47                     ` Dmitry Gutov
2022-11-24  7:48                       ` Juri Linkov
2022-11-25  7:35                         ` Kévin Le Gouguec
2024-02-13 16:52               ` Juri Linkov
2024-02-14  9:25                 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-15  7:23                   ` Juri Linkov
2021-07-26 23:28   ` Dmitry Gutov
2021-07-27 17:08     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-27 20:51       ` Juri Linkov
2021-07-27 23:11         ` Dmitry Gutov
2021-07-28  0:08       ` Dmitry Gutov
2021-07-28 16:12         ` Juri Linkov
2021-07-29  2:02           ` Dmitry Gutov
2021-07-29 17:43             ` Juri Linkov
2021-08-02  2:09               ` Dmitry Gutov [this message]
2021-08-02 20:58                 ` Juri Linkov
2021-08-06  0:03                   ` Dmitry Gutov
2021-07-31 16:45         ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-31 17:06           ` Eli Zaretskii
2022-11-23 18:48       ` 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=54489bae-ec24-43e7-a600-7189cad19bb5@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=49731@debbugs.gnu.org \
    --cc=juri@linkov.net \
    --cc=mardani29@yahoo.es \
    /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).