all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Philip Kaludercic <philipk@posteo.net>, 53644@debbugs.gnu.org
Subject: bug#53644: 29.0.50; xref-search-program breaks if programm not installed on a remote host
Date: Fri, 4 Feb 2022 04:00:17 +0200	[thread overview]
Message-ID: <df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@yandex.ru> (raw)
In-Reply-To: <87v8y0rdz3.fsf@posteo.net>

Hi Philip,

On 31.01.2022 01:38, Philip Kaludercic wrote:
> When invoking a command that respects xref-search-program via TRAMP,
> e.g. on a remote system that doesn't have (in my case ripgrep)
> installed, an error is signalled indicating that the search query
> couldn't be executed.

One way to work around this will probably involve an addition to 
find-file-hook and some code which checks (file-remote-p 
buffer-file-name) and sets xref-search-program to a particular value 
buffer-locally depending on the result.

Or an around-advice for xref-matches-in-files.

> I managed to temporarily circumvent the issue with this patch
> 
> 
> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
> index c812f28c1b..92c3d5c9d5 100644
> --- a/lisp/progmodes/project.el
> +++ b/lisp/progmodes/project.el
> @@ -794,6 +794,11 @@ project-find-regexp
>     (let* ((caller-dir default-directory)
>            (pr (project-current t))
>            (default-directory (project-root pr))
> +         (xref-search-program
> +          (if (and (eq xref-search-program 'ripgrep)
> +                   (not (executable-find "rg" t)))
> +              'grep
> +              xref-search-program))
>            (files
>             (if (not current-prefix-arg)
>                 (project-files pr)
> 
> 
> but just assuming that grep is available might just push the actual
> problem aside.  Should xref-search-program be able to indicate a
> failback, and perhaps even eventually fall back onto a elisp grep that
> might be slow but at least would do the job?

This seems like it will have to call 'executable-find' every time the 
command is used on a remote host, and I imagine that's not free. 
Especially with high network lag. For fast searches (and distant/slow 
hosts) it might almost double the execution time.

A proper solution would probably look more similar to 
grep-host-defaults-alist and grep-compute-defaults.

I'm not sure whether xref should grow a separate facility like that, 
though, or whether xref-search-program can become more assimilated into 
grep.el instead.





  reply	other threads:[~2022-02-04  2:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-30 23:38 bug#53644: 29.0.50; xref-search-program breaks if programm not installed on a remote host Philip Kaludercic
2022-02-04  2:00 ` Dmitry Gutov [this message]
2022-02-04  8:15   ` Michael Albinus
2022-02-04 19:45     ` Dmitry Gutov
2022-02-05 14:38       ` Michael Albinus
2022-02-07  2:57         ` Dmitry Gutov
2022-02-07  9:18           ` Michael Albinus
2022-02-07 18:34             ` Michael Albinus
2022-02-08 11:15           ` Philip Kaludercic
2022-02-08 14:59             ` Michael Albinus
2022-02-08 17:12               ` Philip Kaludercic
2022-02-08 18:30                 ` Michael Albinus
2022-02-08 21:16                   ` Philip Kaludercic
2022-02-09  7:55                     ` Michael Albinus
2022-02-09  9:17                       ` Philip Kaludercic
2022-02-12  1:04                         ` Dmitry Gutov
2022-02-14 13:57                           ` Philip Kaludercic
2022-02-14 14:40                             ` Dmitry Gutov
2022-02-14 17:32                               ` Philip Kaludercic
2022-02-15  1:27                                 ` Dmitry Gutov
2022-02-15 16:32                                   ` Philip Kaludercic
2022-02-15 16:33                                     ` Dmitry Gutov
2022-02-15 16:37                                     ` 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=df2abe5e-f10b-5e31-47bc-8b3bc3db6e82@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=53644@debbugs.gnu.org \
    --cc=philipk@posteo.net \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.